public void Visit(TimestampType type) { TimestampArray.Builder resultBuilder = new TimestampArray.Builder().Reserve(_baseDataTotalElementCount); DateTimeOffset basis = DateTimeOffset.UtcNow; for (int i = 0; i < _baseDataListCount; i++) { List <int?> dataList = _baseData[i]; TimestampArray.Builder builder = new TimestampArray.Builder().Reserve(dataList.Count); foreach (int?value in dataList) { if (value.HasValue) { DateTimeOffset dateValue = basis.AddMilliseconds(value.Value); builder.Append(dateValue); resultBuilder.Append(dateValue); } else { builder.AppendNull(); resultBuilder.AppendNull(); } } TestTargetArrayList.Add(builder.Build()); } ExpectedArray = resultBuilder.Build(); }
/// <summary> /// Performs the ReadProviderOrganisation call. /// </summary> /// <param name="request">The request used to perform the ReadProviderOrganisation.</param> /// <returns>The response returned from the ReadProviderOrganisation call.</returns> /// <exception cref="ApplicationException">Any exceptions returned from the call.</exception> public readProviderOrganisationResponse ReadProviderOrganisation(readProviderOrganisation request) { var timestamp = new TimestampType { created = DateTime.Now.ToUniversalTime(), expires = DateTime.Now.AddDays(30).ToUniversalTime(), expiresSpecified = true }; var readProviderOrganisationRequest = new readProviderOrganisationRequest( product, new SignatureContainerType(), timestamp, user, request); LastSoapRequestTimestamp = readProviderOrganisationRequest.timestamp; readProviderOrganisationResponse1 response = null; try { response = providerReadProviderOrganisationClient.readProviderOrganisation(readProviderOrganisationRequest); } catch (Exception ex) { FaultHelper.ProcessAndThrowFault <ServiceMessagesType>(ex); } if (response != null && response.readProviderOrganisationResponse != null) { return(response.readProviderOrganisationResponse); } throw new ApplicationException(Properties.Resources.UnexpectedServiceResponse); }
public void TimestampRounding() { DateTime input = new DateTime(2000, 1, 1, 10, 11, 12, 13); DateTime expected = new DateTime(2000, 1, 1, 10, 11, 12, 10); Assert.AreEqual(expected, TimestampType.Round(input, d.TimestampResolutionInTicks)); }
/// <summary> /// Parse a trade /// </summary> /// <param name="token">Token</param> /// <param name="amountKey">Amount key</param> /// <param name="priceKey">Price key</param> /// <param name="typeKey">Type key</param> /// <param name="timestampKey">Timestamp key</param> /// <param name="timestampType">Timestamp type</param> /// <param name="idKey">Id key</param> /// <param name="typeKeyIsBuyValue">Type key buy value</param> /// <returns>Trade</returns> internal static ExchangeTrade ParseTrade(this JToken token, object amountKey, object priceKey, object typeKey, object timestampKey, TimestampType timestampType, object idKey, string typeKeyIsBuyValue = "buy") { ExchangeTrade trade = new ExchangeTrade { Amount = token[amountKey].ConvertInvariant <decimal>(), Price = token[priceKey].ConvertInvariant <decimal>(), IsBuy = (token[typeKey].ToStringInvariant().EqualsWithOption(typeKeyIsBuyValue)), }; trade.Timestamp = (timestampKey == null ? CryptoUtility.UtcNow : CryptoUtility.ParseTimestamp(token[timestampKey], timestampType)); if (idKey == null) { trade.Id = trade.Timestamp.Ticks.ToStringInvariant(); } else { try { trade.Id = token[idKey].ToStringInvariant(); } catch { // dont care } } return(trade); }
/// <summary> /// Convert a timestamp to DateTime. If value is null, DateTime.UtcNow is returned. /// </summary> /// <param name="value">Timestamp object (JToken, string, double, etc.)</param> /// <param name="type">Type of timestamp</param> /// <returns>DateTime</returns> public static DateTime ParseTimestamp(object value, TimestampType type) { if (value == null || type == TimestampType.None) { return(DateTime.UtcNow); } switch (type) { case TimestampType.Iso8601: return(value.ToDateTimeInvariant()); case TimestampType.UnixMillisecondsDouble: return(UnixTimeStampToDateTimeMilliseconds(value.ConvertInvariant <double>())); case TimestampType.UnixMilliseconds: return(UnixTimeStampToDateTimeMilliseconds(value.ConvertInvariant <long>())); case TimestampType.UnixSecondsDouble: return(UnixTimeStampToDateTimeSeconds(value.ConvertInvariant <double>())); case TimestampType.UnixSeconds: return(UnixTimeStampToDateTimeSeconds(value.ConvertInvariant <long>())); default: throw new ArgumentException("Invalid timestamp type " + type); } }
private void TestSetTimestamp(FileType fileType, TimestampType timestampType) { //Create File CreateFile(fileType); //Set FileBasicInformation with tested timestamp equal to 01/05/2008 8:00:00 //FSBO Section 6, FAT32 processess LastAccessTime in 1 day resolution (usually 8:00:00) DateTime date = new DateTime(2009, 4, 1, 8, 0, 0); long fileTime = date.ToFileTime(); string inputDate = date.ToString(); SetTimestampUnderTest(timestampType, fileTime); //Query FileBasicInformation long creationTime; long changeTime; long lastAccessTime; long lastWriteTime; QueryFileBasicInformation(out changeTime, out creationTime, out lastAccessTime, out lastWriteTime); //Verify file timestamp was updated long timestampUnderTest = timestampType switch { TimestampType.CreationTime => creationTime, TimestampType.ChangeTime => changeTime, TimestampType.LastAccessTime => lastAccessTime, TimestampType.LastWriteTime => lastWriteTime, }; string underTestTimestamp = DateTime.FromFileTime(timestampUnderTest).ToString(); string openFileParameter = timestampType.Equals(TimestampType.ChangeTime) ? "LastChangeTime" : timestampType.ToString(); this.fsaAdapter.AssertAreEqual(this.Manager, inputDate, underTestTimestamp, "The object store MUST set Open.File." + openFileParameter + " to InputBuffer." + timestampType + "."); }
internal static T ParseTradeComponents <T>(this JToken token, object amountKey, object priceKey, object typeKey, object timestampKey, TimestampType timestampType, object idKey, string typeKeyIsBuyValue = "buy") where T : ExchangeTrade, new() { T trade = new T { Amount = token[amountKey].ConvertInvariant <decimal>(), Price = token[priceKey].ConvertInvariant <decimal>(), IsBuy = (token[typeKey].ToStringInvariant().EqualsWithOption(typeKeyIsBuyValue)), }; trade.Timestamp = (timestampKey == null ? CryptoUtility.UtcNow : CryptoUtility.ParseTimestamp(token[timestampKey], timestampType)); if (idKey == null) { trade.Id = trade.Timestamp.Ticks.ToStringInvariant(); } else { try { trade.Id = token[idKey].ToStringInvariant(); } catch { Logger.Info("error parsing trade ID: " + token.ToStringInvariant()); } } return(trade); }
public void ProducesExpectedArray() { var now = DateTimeOffset.UtcNow.ToLocalTime(); var timestampType = new TimestampType(TimeUnit.Nanosecond, TimeZoneInfo.Local); var array = new TimestampArray.Builder(timestampType) .Append(now) .Build(); Assert.Equal(1, array.Length); var value = array.GetTimestamp(0); Assert.NotNull(value); Assert.Equal(now, value.Value); timestampType = new TimestampType(TimeUnit.Microsecond, TimeZoneInfo.Local); array = new TimestampArray.Builder(timestampType) .Append(now) .Build(); Assert.Equal(1, array.Length); value = array.GetTimestamp(0); Assert.NotNull(value); Assert.Equal(now.Truncate(TimeSpan.FromTicks(10)), value.Value); timestampType = new TimestampType(TimeUnit.Millisecond, TimeZoneInfo.Local); array = new TimestampArray.Builder(timestampType) .Append(now) .Build(); Assert.Equal(1, array.Length); value = array.GetTimestamp(0); Assert.NotNull(value); Assert.Equal(now.Truncate(TimeSpan.FromTicks(TimeSpan.TicksPerMillisecond)), value.Value); }
public TimestampArray( TimestampType type, ArrowBuffer valueBuffer, ArrowBuffer nullBitmapBuffer, int length, int nullCount, int offset) : this(new ArrayData(type, length, nullCount, offset, new[] { nullBitmapBuffer, valueBuffer })) { }
public retrieveSearchForProviderIndividualRequest(nehta.mcaR50.ProviderBatchSearchForProviderIndividual.retrieveSearchForProviderIndividual retrieveSearchForProviderIndividual, ProductType product, TimestampType timestamp, SignatureContainerType signature, QualifiedId user, QualifiedId hpio) { this.retrieveSearchForProviderIndividual = retrieveSearchForProviderIndividual; this.product = product; this.timestamp = timestamp; this.signature = signature; this.user = user; this.hpio = hpio; }
private void FileInfo_Set_FileBasicInformation_Positive(FileType fileType, TimestampType timestampType) { BaseTestSite.Log.Add(LogEntryKind.TestStep, "Test case steps:"); //Step 1: SetFileInformation with FileInfoClass.FILE_BASIC_INFORMATION and verify that file timestamp is updated BaseTestSite.Log.Add(LogEntryKind.TestStep, "1. SetFileInformation with FileInfoClass.FILE_BASIC_INFORMATION having valid timestamp and verify that file timestamp is updated"); TestSetTimestamp(fileType, timestampType); }
internal static ExchangeTrade ParseTradeKucoin(this JToken token, object amountKey, object priceKey, object typeKey, object timestampKey, TimestampType timestampType, object idKey, string typeKeyIsBuyValue = "buy") { var trade = ParseTradeComponents <KuCoinTrade>(token, amountKey, priceKey, typeKey, timestampKey, timestampType, idKey, typeKeyIsBuyValue); trade.MakerOrderId = token["makerOrderId"].ToStringInvariant().StringToByteArray(); trade.TakerOrderId = token["takerOrderId"].ToStringInvariant().StringToByteArray(); return(trade); }
public async Task NextAsync() { TimestampType type = (TimestampType)NHibernateUtil.Timestamp; object current = DateTime.Parse("2004-01-01"); object next = await(type.NextAsync(current, null, CancellationToken.None)); Assert.IsTrue(next is DateTime, "Next should be DateTime"); Assert.IsTrue((DateTime)next > (DateTime)current, "next should be greater than current (could be equal depending on how quickly this occurs)"); }
public void Next() { TimestampType type = (TimestampType)NHibernateUtil.Timestamp; object current = DateTime.Parse("2004-01-01"); object next = type.Next(current, null); Assert.IsTrue(next is DateTime, "Next should be DateTime"); Assert.IsTrue((DateTime)next > (DateTime)current, "next should be greater than current (could be equal depending on how quickly this occurs)"); }
internal static ExchangeTrade ParseTradeCoinbase(this JToken token, object amountKey, object priceKey, object typeKey, object timestampKey, TimestampType timestampType, object idKey, string typeKeyIsBuyValue = "buy") { var trade = ParseTradeComponents <CoinbaseTrade>(token, amountKey, priceKey, typeKey, timestampKey, timestampType, idKey, typeKeyIsBuyValue); trade.MakerOrderId = (Guid)token["maker_order_id"]; trade.TakerOrderId = (Guid)token["taker_order_id"]; return(trade); }
internal static ExchangeTrade ParseTradeBinance(this JToken token, object amountKey, object priceKey, object typeKey, object timestampKey, TimestampType timestampType, object idKey, string typeKeyIsBuyValue = "buy") { var trade = ParseTradeComponents <BinanceAggregateTrade>(token, amountKey, priceKey, typeKey, timestampKey, timestampType, idKey, typeKeyIsBuyValue); trade.FirstTradeId = token["f"].ConvertInvariant <long>(); trade.LastTradeId = token["l"].ConvertInvariant <long>(); return(trade); }
internal static ExchangeTrade ParseTradeBitstamp(this JToken token, object amountKey, object priceKey, object typeKey, object timestampKey, TimestampType timestampType, object idKey, string typeKeyIsBuyValue = "buy") { var trade = ParseTradeComponents <BitstampTrade>(token, amountKey, priceKey, typeKey, timestampKey, timestampType, idKey, typeKeyIsBuyValue); trade.BuyOrderId = token["buy_order_id"].ConvertInvariant <long>(); trade.SellOrderId = token["sell_order_id"].ConvertInvariant <long>(); return(trade); }
public TimestampArray( TimestampType type, ArrowBuffer valueBuffer, ArrowBuffer nullBitmapBuffer, int length, int nullCount, int offset) : this(new ArrayData(type, length, nullCount, offset, new[] { nullBitmapBuffer, valueBuffer })) { TimeZone = type.Timezone != null ? TimeZoneInfo.FindSystemTimeZoneById(type.Timezone) ?? TimeZoneInfo.Utc : TimeZoneInfo.Utc; }
public void Visit(TimestampType type) { var builder = new TimestampArray.Builder().Reserve(Length); var basis = DateTimeOffset.UtcNow.AddMilliseconds(-Length); for (var i = 0; i < Length; i++) { builder.Append(basis.AddMilliseconds(i)); } Array = builder.Build(); }
// Remark: it might be the case that brokers are authorized to send us partial record batch. // So if the protocol exceptions in this method are triggered, you might want to investigate and remove // them altogether. public void Deserialize(ReusableMemoryStream input, Deserializers deserializers, long endOfAllBatches) { if (input.Position + BytesNecessaryToGetLength > endOfAllBatches) { throw new ProtocolException( $"Trying to read a batch record at {input.Position} and the end of all batches is {endOfAllBatches}." + $" There is not enough bytes remaining to even read the first fields..."); } BaseOffset = BigEndianConverter.ReadInt64(input); var batchLength = BigEndianConverter.ReadInt32(input); var endOfBatch = input.Position + batchLength; if (endOfAllBatches < endOfBatch) { throw new ProtocolException( $"The record batch says it has length that stops at {endOfBatch} but the list of all batches stop at {endOfAllBatches}."); } PartitionLeaderEpoch = BigEndianConverter.ReadInt32(input); var magic = input.ReadByte(); // Current magic value is 2 if ((uint)magic != 2) { throw new UnsupportedMagicByteVersion((byte)magic, "2"); } var crc = (uint)BigEndianConverter.ReadInt32(input); var afterCrcPosition = input.Position; // The crc is calculated starting from this position Crc32.CheckCrcCastagnoli((int)crc, input, afterCrcPosition, endOfBatch - afterCrcPosition); var attributes = BigEndianConverter.ReadInt16(input); CompressionCodec = (CompressionCodec)(attributes & CompressionCodecMask); IsTransactional = (attributes & TransactionalFlagMask) != 0; IsControl = (attributes & ControlFlagMask) != 0; TimestampType = (attributes & TimestampTypeMask) > 0 ? TimestampType.LogAppendTime : TimestampType.CreateTime; var lastOffsetDelta = BigEndianConverter.ReadInt32(input); var firstTimestamp = BigEndianConverter.ReadInt64(input); var maxTimestamp = BigEndianConverter.ReadInt64(input); ProducerId = BigEndianConverter.ReadInt64(input); ProducerEpoch = BigEndianConverter.ReadInt16(input); BaseSequence = BigEndianConverter.ReadInt32(input); var numberOfRecords = BigEndianConverter.ReadInt32(input); Records = DeserializeRecords(input, numberOfRecords, endOfBatch, firstTimestamp, deserializers); }
public void Visit(TimestampType type) { StringOffset timezoneStringOffset = default; if (!string.IsNullOrWhiteSpace(type.Timezone)) { timezoneStringOffset = Builder.CreateString(type.Timezone); } Result = FieldType.Build( Flatbuf.Type.Timestamp, Flatbuf.Timestamp.CreateTimestamp(Builder, ToFlatBuffer(type.Unit), timezoneStringOffset)); }
public static string ReplaceTimestamp(this String str, TimestampType timestampType = TimestampType.Testing) { switch (timestampType) { case (TimestampType.Batch): return(str.Replace("{TIMESTAMP}", "%datetime%")); case (TimestampType.VBS): return(str.Replace("{TIMESTAMP}", @""" + sprintf(""{0:yyyy-MM-dd hh-mm-ss}"", Array(datetime)) + """)); default: return(str.Replace("{TIMESTAMP}", DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss"))); } }
/// <summary> /// Common order book parsing method, most exchanges use "asks" and "bids" with /// arrays of length 2 for price and amount (or amount and price) /// </summary> /// <param name="token">Token</param> /// <param name="symbol"></param> /// <param name="asks">Asks key</param> /// <param name="bids">Bids key</param> /// <param name="timestampType"></param> /// <param name="maxCount">Max count</param> /// <param name="sequence"></param> /// <returns>Order book</returns> internal static ExchangeDepth ParseDepthFromJTokenArrays ( this JToken token, Symbol symbol, string asks = "asks", string bids = "bids", string sequence = "ts", TimestampType timestampType = TimestampType.None, int maxCount = 100 ) { var book = new ExchangeDepth { SequenceId = token[sequence].ConvertInvariant <long>(), LastUpdatedUtc = CryptoUtility.ParseTimestamp(token[sequence], timestampType), Symbol = symbol }; foreach (JArray array in token[asks]) { var depth = new ExchangeOrderPrice { Price = array[0].ConvertInvariant <decimal>(), Amount = array[1].ConvertInvariant <decimal>() }; book.Asks[depth.Price] = depth; if (book.Asks.Count == maxCount) { break; } } foreach (JArray array in token[bids]) { var depth = new ExchangeOrderPrice { Price = array[0].ConvertInvariant <decimal>(), Amount = array[1].ConvertInvariant <decimal>() }; book.Bids[depth.Price] = depth; if (book.Bids.Count == maxCount) { break; } } return(book); }
/// <summary> /// Perform a consumer batch ihi search on the Medicare IHI service. /// </summary> /// <param name="searches">List of SearchIHIRequestType containing the request identifier and the search parameters.</param> /// <returns>Results matching the search parameters. Different fields are returned for diffent search types. For full details please refer to: /// <list type="bullet"> /// <item><description><see cref="Pyro.ADHA.VendorLibrary.HI.ConsumerSearchIHIClient.BasicSearch"/></description></item> /// <item><description><see cref="Pyro.ADHA.VendorLibrary.HI.ConsumerSearchIHIClient.BasicMedicareSearch"/></description></item> /// <item><description><see cref="Pyro.ADHA.VendorLibrary.HI.ConsumerSearchIHIClient.BasicDvaSearch"/></description></item> /// <item><description><see cref="Pyro.ADHA.VendorLibrary.HI.ConsumerSearchIHIClient.DetailedSearch"/></description></item> /// <item><description><see cref="Pyro.ADHA.VendorLibrary.HI.ConsumerSearchIHIClient.AustralianPostalAddressSearch"/></description></item> /// <item><description><see cref="Pyro.ADHA.VendorLibrary.HI.ConsumerSearchIHIClient.AustralianStreetAddressSearch"/></description></item> /// <item><description><see cref="Pyro.ADHA.VendorLibrary.HI.ConsumerSearchIHIClient.InternationalAddressSearch"/></description></item> /// </list> /// </returns> public searchIHIBatchResponse SearchIHIBatchSync(List <CommonSearchIHIRequestType> searches) { Validation.ValidateArgumentRequired("searches", searches); searchIHIBatchSyncRequest envelope = new searchIHIBatchSyncRequest(); var mappedSearches = Mapper.Map <List <SearchIHIRequestType> >(searches); //var mappedSearches = Mapper.Map<List<CommonSearchIHIRequestType>, List<SearchIHIRequestType>>(searches); envelope.searchIHIBatchSync = mappedSearches.ToArray(); envelope.product = product; envelope.user = user; envelope.hpio = hpio; envelope.signature = new SignatureContainerType(); envelope.timestamp = new TimestampType() { created = DateTime.Now, expires = DateTime.Now.AddDays(30), expiresSpecified = true }; // Set LastSoapRequestTimestamp LastSoapRequestTimestamp = envelope.timestamp; searchIHIBatchSyncResponse response = null; try { response = ihiBatchClient.searchIHIBatchSync(envelope); } catch (Exception ex) { // Catch generic FaultException and call helper to throw a more specific fault // (FaultException<ServiceMessagesType> FaultHelper.ProcessAndThrowFault <ServiceMessagesType>(ex); } if (response != null && response.searchIHIBatchResponse != null) { return(response.searchIHIBatchResponse); } else { throw new ApplicationException(Properties.Resources.UnexpectedServiceResponse); } }
/// <summary> /// DateTime转换为时间戳 /// </summary> /// <param name="time">时间</param> /// <param name="timestampType">时间戳类型</param> /// <param name="timeZoneInfo">时区</param> /// <returns></returns> public static long ToTimestampByTicks(DateTime time, TimestampType timestampType = TimestampType.JavaScript, TimeZoneInfo timeZoneInfo = null) { var startTime = GetGmtStartTime(timeZoneInfo); switch (timestampType) { case TimestampType.JavaScript: return((time.Ticks - startTime.Ticks) / 10000); case TimestampType.Unix: return((time.Ticks - startTime.Ticks) / 10000000); default: return(0); } }
/// <summary> /// 时间戳转换为DateTime /// </summary> /// <param name="timestamp">时间戳</param> /// <param name="timestampType">时间戳类型</param> /// <param name="timeZoneInfo">时区</param> /// <returns></returns> public static DateTime ToDateTime(double timestamp, TimestampType timestampType = TimestampType.JavaScript, TimeZoneInfo timeZoneInfo = null) { var startTime = GetGmtStartTime(timeZoneInfo); switch (timestampType) { case TimestampType.JavaScript: return(startTime.AddMilliseconds(timestamp)); case TimestampType.Unix: return(startTime.AddSeconds(timestamp)); default: return(default); } }
/// <summary> /// DateTime转换为时间戳 /// </summary> /// <param name="time">时间</param> /// <param name="timestampType">时间戳类型</param> /// <param name="timeZoneInfo">时区</param> /// <returns></returns> public static double ToTimestamp(DateTime time, TimestampType timestampType = TimestampType.JavaScript, TimeZoneInfo timeZoneInfo = null) { var startTime = GetGmtStartTime(timeZoneInfo); switch (timestampType) { case TimestampType.JavaScript: return((time - startTime).TotalMilliseconds); //(dt2.Ticks - dt1.Ticks) / 10000; case TimestampType.Unix: return((time - startTime).TotalSeconds); //(dt2.Ticks - dt1.Ticks) / 10000000; default: return(0); } }
private void SetTimestampUnderTest(TimestampType timestampType, long value) { switch (timestampType) { case TimestampType.ChangeTime: SetChangeTime(value); break; case TimestampType.LastAccessTime: SetLastAccessTime(value); break; case TimestampType.LastWriteTime: SetLastWriteTime(value); break; } }
/// <summary> /// Perform the service call. /// </summary> /// <param name="request">The search criteria in a searchHIProviderDirectoryForIndividual object.</param> /// <returns>The search results in a searchHIProviderDirectoryForIndividualResponse object.</returns> public searchForProviderOrganisationResponse ProviderOrganisationSearch(searchForProviderOrganisation request) { var envelope = new searchForProviderOrganisationRequest() { searchForProviderOrganisation = request, product = product, user = user, hpio = hpio, signature = new SignatureContainerType() }; envelope.timestamp = new TimestampType() { created = DateTime.Now, expires = DateTime.Now.AddDays(30), expiresSpecified = true }; // Set LastSoapRequestTimestamp LastSoapRequestTimestamp = envelope.timestamp; searchForProviderOrganisationResponse1 response1 = null; try { response1 = providerSearchForProviderOrganisationClient.searchForProviderOrganisation(envelope); providerSearchForProviderOrganisationClient.searchForProviderOrganisation(envelope); } catch (Exception ex) { // Catch generic FaultException and call helper to throw a more specific fault // (FaultException<ServiceMessagesType> FaultHelper.ProcessAndThrowFault <ServiceMessagesType>(ex); } if (response1 != null && response1.searchForProviderOrganisationResponse != null) { return(response1.searchForProviderOrganisationResponse); } else { throw new ApplicationException(Properties.Resources.UnexpectedServiceResponse); } }
/// <summary> /// 生成时间戳 /// </summary> /// <param name="target">待转换的时间</param> /// <param name="timestampType">时间戳类型:10位或者13位</param> /// <param name="dateTimeKind"></param> /// <returns></returns> public static long ToUnixTimestamp(this DateTime target, TimestampType timestampType, DateTimeKind dateTimeKind = DateTimeKind.Utc) { if (timestampType.Id == TimestampType.Millisecond.Id) { return((TimeZoneInfo.ConvertTimeToUtc(target).Ticks - TimeZoneInfo .ConvertTimeToUtc(new DateTime(1970, 1, 1, 0, 0, 0, 0, dateTimeKind)).Ticks) / 10000); //除10000调整为13位 } if (timestampType.Id == TimestampType.Second.Id) { return((long)(TimeZoneInfo.ConvertTimeToUtc(target) - new DateTime(1970, 1, 1, 0, 0, 0, dateTimeKind)) .TotalSeconds); } throw new BusinessException("不支持的类型", HttpStatus.Err.Id); }
protected RefreshRequest(TimestampType type) : this(40, type) { }
public Timestamp(TimestampType tsType, DateTime dateTime) { TsType = tsType; Ts = dateTime; }
void Command_Files_Set_Time(TimestampType type, ChooseDateTimeDialog.Result result) { var files = RelativeSelectedFiles(); foreach (var file in files) { if (!FileOrDirectoryExists(file)) File.WriteAllBytes(file, new byte[0]); if (File.Exists(file)) { var info = new FileInfo(file); if (type.HasFlag(TimestampType.Write)) info.LastWriteTime = result.Value; if (type.HasFlag(TimestampType.Access)) info.LastAccessTime = result.Value; if (type.HasFlag(TimestampType.Create)) info.CreationTime = result.Value; } else if (Directory.Exists(file)) { var info = new DirectoryInfo(file); if (type.HasFlag(TimestampType.Write)) info.LastWriteTime = result.Value; if (type.HasFlag(TimestampType.Access)) info.LastAccessTime = result.Value; if (type.HasFlag(TimestampType.Create)) info.CreationTime = result.Value; } } }
protected RefreshRequest(int maxPageSize, TimestampType type) : base(maxPageSize) { _type = type; }