internal Nonce(DateTime creation, string uniqueFragment, bool remoteServerOrigin) { Code = creation.ToUniversalTime().ToString(PermissibleDateTimeFormats[0], CultureInfo.InvariantCulture) + uniqueFragment; CreationDate = creation.ToUniversalTime(); UniqueFragment = uniqueFragment; this.remoteServerOrigin = remoteServerOrigin; }
public Respond DelayedUntil(DateTime time) { alter = (_, e) => e.ExecutionTime = time.ToUniversalTime(); _description += "; Delayed until " + time.ToUniversalTime(); return this; }
public MessageEntity(DateTime dateTime, string userName, string message) { this.PartitionKey = MessagePartionKey; this.RowKey = Convert.ToString(dateTime.ToUniversalTime().Ticks); this.dateTime = dateTime; this.ticks = dateTime.ToUniversalTime().Ticks; this.userName = userName; this.message = message; }
private static void Write(DateTime timestamp, string message, string category, bool newLine) { using (StreamWriter writer = GetWriter()) { if (newLine) { writer.WriteLine(); writer.Write(string.Format("{0} {1} : {2}", timestamp.ToUniversalTime(), category, message)); } else writer.Write(string.Format("{0} {1} : {2}", timestamp.ToUniversalTime(), category, message)); } }
private static void SerializeDateTime(System.DateTime datetime, System.Text.StringBuilder sb, JavaScriptSerializer.SerializationFormat serializationFormat) { if (serializationFormat == JavaScriptSerializer.SerializationFormat.JSON) { sb.Append("\"\\/Date("); sb.Append(((datetime.ToUniversalTime()).Ticks - JavaScriptSerializer.DatetimeMinTimeTicks) / 10000L); sb.Append(")\\/\""); } else { sb.Append("new Date("); sb.Append(((datetime.ToUniversalTime()).Ticks - JavaScriptSerializer.DatetimeMinTimeTicks) / 10000L); sb.Append(")"); } }
// RFC3280, section 4.2.1.5 // CAs conforming to this profile MUST always encode certificate // validity dates through the year 2049 as UTCTime; certificate validity // dates in 2050 or later MUST be encoded as GeneralizedTime. // Under 1.x this API requires a Local datetime to be provided // Under 2.0 it will also accept a Utc datetime static public ASN1 FromDateTime (DateTime dt) { if (dt.Year < 2050) { // UTCTIME return new ASN1 (0x17, Encoding.ASCII.GetBytes ( dt.ToUniversalTime ().ToString ("yyMMddHHmmss", CultureInfo.InvariantCulture) + "Z")); } else { // GENERALIZEDTIME return new ASN1 (0x18, Encoding.ASCII.GetBytes ( dt.ToUniversalTime ().ToString ("yyyyMMddHHmmss", CultureInfo.InvariantCulture) + "Z")); } }
private double GetUnixEpoch(System.DateTime dateTime) { var unixTime = dateTime.ToUniversalTime() - new System.DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); return(unixTime.TotalMilliseconds); }
public static int GetSeconds() { System.DateTime ePoch = new System.DateTime(2012, 1, 1, 0, 0, 0); System.DateTime dateTime = System.DateTime.UtcNow; System.TimeSpan timeSpan = (dateTime.ToUniversalTime() - ePoch); return((int)timeSpan.TotalSeconds); } // GetSeconds
/// <summary> /// 获取时间戳 /// </summary> /// <returns></returns> private long GetTimeStamp(System.DateTime dt) { //TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0); TimeSpan ts = dt.ToUniversalTime() - new DateTime(1970, 1, 1, 0, 0, 0, 0); return(Convert.ToInt64(ts.TotalSeconds)); }
/// <summary> /// 1970年1月1日0時0分0秒からの経過秒を取得する /// </summary> /// <returns></returns> public static long GetClientTime() { System.DateTime tUTC = System.DateTime.UtcNow; tUTC = tUTC.ToUniversalTime(); System.TimeSpan tTimeSpan = tUTC - UNIX_EPOCH; return(( long )tTimeSpan.TotalSeconds); }
void DisplayDateTimeFullInfo(System.DateTime dateTime, string title) { MessageBox.Show(title + Environment.NewLine + " ToString()=" + dateTime.ToString() + Environment.NewLine + " ToShortDateString()=" + dateTime.ToShortDateString() + Environment.NewLine + " ToShortTimeString()=" + dateTime.ToShortTimeString() + Environment.NewLine //+ " ToLongTimeString()=" + dateTime.ToLongTimeString() + Environment.NewLine + " ToUniversalTime().ToString()=" + dateTime.ToUniversalTime().ToString() + Environment.NewLine + " ToLocalTime().ToString()=" + dateTime.ToLocalTime().ToString() + Environment.NewLine + " ToUniversalTime().ToLocalTime().ToString()=" + dateTime.ToUniversalTime().ToLocalTime().ToString() + Environment.NewLine + " ToLocalTime().ToUniversalTime().ToString()=" + dateTime.ToLocalTime().ToUniversalTime() + Environment.NewLine + " Hours=" + dateTime.Hour.ToString() + Environment.NewLine + " Minutes=" + dateTime.Minute.ToString() + Environment.NewLine + " Seconds=" + dateTime.Second.ToString() + Environment.NewLine ); }
public static double ConvertToUnixTimestamp(DateTime date) { DateTime origin = new DateTime(1970, 1, 1, 0, 0, 0, 0); TimeSpan diff = date.ToUniversalTime() - origin; return Math.Round(Math.Floor(diff.TotalSeconds), 0); }
public void SaveDateTimeToDatabase() { var dbFactory = new OrmLiteConnectionFactory(base.ConnectionString, SqlServerOrmLiteDialectProvider.Instance); SqlServerOrmLiteDialectProvider.Instance.EnsureUtc(true); using (var db = dbFactory.OpenDbConnection()) { var dateTime = new DateTime(2012, 1, 1, 1, 1, 1, DateTimeKind.Local); var x = InsertAndSelectDateTime(db, dateTime); Assert.AreEqual(DateTimeKind.Utc, x.Test.Kind); Assert.AreEqual(x.Test.ToUniversalTime(), dateTime.ToUniversalTime()); Assert.AreEqual(x.Test.ToLocalTime(), dateTime.ToLocalTime()); dateTime = new DateTime(2012, 1, 1, 1, 1, 1, DateTimeKind.Utc); x = InsertAndSelectDateTime(db, dateTime); Assert.AreEqual(DateTimeKind.Utc, x.Test.Kind); Assert.AreEqual(x.Test.ToUniversalTime(), dateTime.ToUniversalTime()); Assert.AreEqual(x.Test.ToLocalTime(), dateTime.ToLocalTime()); dateTime = new DateTime(2012, 1, 1, 1, 1, 1, DateTimeKind.Unspecified); x = InsertAndSelectDateTime(db, dateTime); Assert.AreEqual(DateTimeKind.Utc, x.Test.Kind); Assert.AreEqual(x.Test.ToUniversalTime(), dateTime); Assert.AreEqual(x.Test.ToLocalTime(), dateTime.ToLocalTime()); } }
/// <summary> /// 从1970纪元起UTC时间的时间戳 /// </summary> /// <param name="dateTime"></param> /// <returns></returns> public static long GetLongTime(DateTime dateTime) { DateTime startDate = new DateTime(1970, 1, 1); DateTime endDate = dateTime.ToUniversalTime(); TimeSpan span = endDate - startDate; return (long)(span.TotalMilliseconds + 0.5); }
public void SetData(byte[] data, int index, int count) { using (MemoryStream stream = new MemoryStream(data, index, count, false)) { using (ZipHelperStream stream2 = new ZipHelperStream(stream)) { this._flags = (Flags) ((byte) stream2.ReadByte()); if ((((byte) (this._flags & Flags.ModificationTime)) != 0) && (count >= 5)) { int seconds = stream2.ReadLEInt(); DateTime time = new DateTime(0x7b2, 1, 1, 0, 0, 0); this._modificationTime = (time.ToUniversalTime() + new TimeSpan(0, 0, 0, seconds, 0)).ToLocalTime(); } if (((byte) (this._flags & Flags.AccessTime)) != 0) { int num2 = stream2.ReadLEInt(); DateTime time3 = new DateTime(0x7b2, 1, 1, 0, 0, 0); this._lastAccessTime = (time3.ToUniversalTime() + new TimeSpan(0, 0, 0, num2, 0)).ToLocalTime(); } if (((byte) (this._flags & Flags.CreateTime)) != 0) { int num3 = stream2.ReadLEInt(); DateTime time5 = new DateTime(0x7b2, 1, 1, 0, 0, 0); this._createTime = (time5.ToUniversalTime() + new TimeSpan(0, 0, 0, num3, 0)).ToLocalTime(); } } } }
protected Event(DateTime dateTime, Galaxy galaxy) { Time = dateTime.ToUniversalTime(); Galaxy = galaxy; Turn = galaxy.Turn; Round = galaxy.Round; }
public static string FormatUTCString(DateTime _input) { var milliseconds = _input.ToUniversalTime().Subtract( new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalMilliseconds; return Convert.ToInt64(milliseconds).ToString(); }
public static string FormatInEnglish(DateTime time) { Debug.Assert(time.Kind != DateTimeKind.Unspecified); // Adapted from http://stackoverflow.com/a/1248/6682 // License cc-wiki: http://creativecommons.org/licenses/by-sa/2.5/ const int second = 1; const int minute = 60 * second; const int hour = 60 * minute; const int day = 24 * hour; const int month = 30 * day; var ts = TimeSpan.FromTicks((DateTime.UtcNow.Ticks - time.ToUniversalTime().Ticks)); var delta = Math.Abs(ts.TotalSeconds); var provider = DateTimeFormatInfo.InvariantInfo; return delta < 0 ? "not yet" : delta < 1 * minute ? (ts.Seconds == 1 ? "one second ago" : ts.Seconds.ToString(provider) + " seconds ago") : delta < 2 * minute ? "a minute ago" : delta < 45 * minute ? ts.Minutes.ToString(provider) + " minutes ago" : delta < 90 * minute ? "an hour ago" : delta < 24 * hour ? ts.Hours.ToString(provider) + " hours ago" : delta < 48 * hour ? "yesterday" : delta < 5 * day ? ts.Days.ToString(provider) + " days ago" : time.ToString(delta < 6 * month ? "MMM d" : "MMM yyyy", provider); }
public override IList<SearchDocument> GetModifiedSearchDocuments (ModuleInfo modInfo, DateTime beginDate) { var searchDocs = new List<SearchDocument> (); var settings = new DivisionSettingsRepository ().GetSettings (modInfo); using (var modelContext = new UniversityModelContext ()) { var division = modelContext.Get<DivisionInfo> (settings.DivisionID); if (division != null && division.LastModifiedOnDate.ToUniversalTime () > beginDate.ToUniversalTime ()) { var aboutDivision = division.SearchDocumentText; var sd = new SearchDocument () { PortalId = modInfo.PortalID, AuthorUserId = division.LastModifiedByUserID, Title = division.Title, // Description = HtmlUtils.Shorten (aboutDivision, 255, "..."), Body = aboutDivision, ModifiedTimeUtc = division.LastModifiedOnDate.ToUniversalTime (), UniqueKey = string.Format ("University_Division_{0}", division.DivisionID), Url = string.Format ("/Default.aspx?tabid={0}#{1}", modInfo.TabID, modInfo.ModuleID), IsActive = division.IsPublished (DateTime.Now) }; searchDocs.Add (sd); } return searchDocs; } }
public byte[] GetData() { byte[] buffer; using (MemoryStream stream = new MemoryStream()) { using (ZipHelperStream stream2 = new ZipHelperStream(stream)) { stream2.IsStreamOwner = false; stream2.WriteByte((byte) this._flags); if (((byte) (this._flags & Flags.ModificationTime)) != 0) { DateTime time = new DateTime(0x7b2, 1, 1, 0, 0, 0); TimeSpan span = (TimeSpan) (this._modificationTime.ToUniversalTime() - time.ToUniversalTime()); int totalSeconds = (int) span.TotalSeconds; stream2.WriteLEInt(totalSeconds); } if (((byte) (this._flags & Flags.AccessTime)) != 0) { DateTime time2 = new DateTime(0x7b2, 1, 1, 0, 0, 0); TimeSpan span2 = (TimeSpan) (this._lastAccessTime.ToUniversalTime() - time2.ToUniversalTime()); int num2 = (int) span2.TotalSeconds; stream2.WriteLEInt(num2); } if (((byte) (this._flags & Flags.CreateTime)) != 0) { DateTime time3 = new DateTime(0x7b2, 1, 1, 0, 0, 0); TimeSpan span3 = (TimeSpan) (this._createTime.ToUniversalTime() - time3.ToUniversalTime()); int num3 = (int) span3.TotalSeconds; stream2.WriteLEInt(num3); } buffer = stream.ToArray(); } } return buffer; }
public CalendarModel(DateTime startDateP, TennisUserModel tennisUserP, SportsLinkDB dbP) : base(tennisUserP) { this.UserStartDate = IndexModel.GetLocalDate(startDateP.ToUniversalTime(), tennisUserP.TimeZoneOffset); this.UserStartDate = this.UserStartDate.AddDays(-(int)this.UserStartDate.DayOfWeek); this.StartDate = IndexModel.GetUtcDate(this.UserStartDate, tennisUserP.TimeZoneOffset); this.EndDate = this.StartDate.AddDays(7); if (null == CachedQuery) { var offers = ModelUtils.GetOffersFunc(); Expression<Func<SportsLinkDB, TennisUserModel, DateTime, DateTime, IQueryable<OfferModel>>> results = (SportsLinkDB db, TennisUserModel tennisUser, DateTime startDate, DateTime endDate) => offers.Invoke(db, tennisUser) .Where(o => o.RequestUser.FacebookId != tennisUser.FacebookId) .Where(o => o.SpecificOpponent == null || o.SpecificOpponent.FacebookId == tennisUser.FacebookId || o.RequestUser.FacebookId == tennisUser.FacebookId) .Where(o => o.ConfirmedUser == null || o.ConfirmedUser.FacebookId == tennisUser.FacebookId || o.RequestUser.FacebookId == tennisUser.FacebookId) .Where(o => o.MatchDateUtc >= startDate) .Where(o => o.MatchDateUtc < endDate) .Where(o => o.MatchDateUtc >= DateTime.UtcNow || null != o.ConfirmedUser) .OrderBy(o => o.MatchDateUtc); CachedQuery = CompiledQuery.Compile<SportsLinkDB, TennisUserModel, DateTime, DateTime, IQueryable<OfferModel>> ( results.Expand() ); } this.Offers = CachedQuery(dbP, tennisUserP, this.StartDate, this.EndDate); }
public static double ConvertDateToSeconds(DateTime date) { DateTime origin = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc); TimeSpan diff = date.ToUniversalTime() - origin; return(Math.Floor(diff.TotalSeconds)); }
/// <summary> /// Clears log messages between a date range and for specified log levels /// </summary> /// <param name="start">start date</param> /// <param name="end">end date</param> /// <param name="logLevels">string array of log levels</param> public void ClearLog(DateTime start, DateTime end, string[] logLevels) { string logLevelList = ""; foreach (string logLevel in logLevels) { logLevelList += ",'" + logLevel + "'"; } if (logLevelList.Length > 0) { logLevelList = logLevelList.Substring(1); } string commandText = "delete from Log4Net_Error WHERE [Date] >= @p0 and [Date] <= @p1 and Level in (@p2)"; SqlParameter paramStartDate = new SqlParameter { ParameterName = "p0", Value = start.ToUniversalTime(), DbType = System.Data.DbType.DateTime }; SqlParameter paramEndDate = new SqlParameter { ParameterName = "p1", Value = end.ToUniversalTime(), DbType = System.Data.DbType.DateTime }; SqlParameter paramLogLevelList = new SqlParameter { ParameterName = "p2", Value = logLevelList }; //_context.ExecuteStoreCommand(commandText, paramStartDate, paramEndDate, paramLogLevelList); //required because this code (from http://dotnetdarren.wordpress.com/2010/07/29/logging-in-mvc-part-5-the-model-and-data-layer/) // was created with an older version of EF, where an objectcontext was used rather than a DBContext (which was created by EF) var adapter = (IObjectContextAdapter)_context; var objectContext = adapter.ObjectContext; objectContext.ExecuteStoreCommand(commandText, paramStartDate, paramEndDate, paramLogLevelList); }
/// <summary> /// Helper method to get the time difference between two DateTime objects /// </summary> /// <param name="start">start time (in the current local time zone)</param> /// <param name="end">end time (in the current local time zone)</param> /// <returns>the time difference in milliseconds</returns> private static long TimeDifferenceInMillis(DateTime start, DateTime end) { // We must convert all times to UTC before performing any mathematical // operations on them. This allows use to take into account discontinuities // caused by daylight savings time transitions. return (long)(end.ToUniversalTime() - start.ToUniversalTime()).TotalMilliseconds; }
//Assumes the datastream is setup public async Task GetData(HashSet<IKey> keys, DateTime dtbegin, DateTime dtend, String outputFileName) { if (datastream == null) return; FileStream fs = new FileStream(outputFileName, FileMode.Append); StreamWriter swOut = new StreamWriter(fs); DateTime dtbeginutc = dtbegin.ToUniversalTime(); DateTime dtendutc = dtend.ToUniversalTime(); foreach (IKey key in keys) { IEnumerable<IDataItem> dataItemEnum = await Task.Run(() => datastream.GetAll(key, dtbeginutc.Ticks, dtendutc.Ticks)); if (dataItemEnum != null) { foreach (IDataItem di in dataItemEnum) { DateTime ts = new DateTime(di.GetTimestamp()); swOut.WriteLine(key + ", " + ts.ToLocalTime() + ", " + di.GetVal().ToString()); } } } swOut.Close(); }
private void EST (TimeZone t1) { // It could be EST though... //Assert.AreEqual("Eastern Standard Time", t1.StandardName, "B01"); //Assert.AreEqual("Eastern Daylight Time", t1.DaylightName, "B02"); DaylightTime d1 = t1.GetDaylightChanges (2002); Assert.AreEqual("04/07/2002 02:00:00", d1.Start.ToString ("G", CultureInfo.InvariantCulture), "B03"); Assert.AreEqual("10/27/2002 02:00:00", d1.End.ToString ("G", CultureInfo.InvariantCulture), "B04"); Assert.AreEqual(36000000000L, d1.Delta.Ticks, "B05"); DaylightTime d2 = t1.GetDaylightChanges (1996); Assert.AreEqual("04/07/1996 02:00:00", d2.Start.ToString ("G", CultureInfo.InvariantCulture), "B06"); Assert.AreEqual("10/27/1996 02:00:00", d2.End.ToString ("G", CultureInfo.InvariantCulture), "B07"); Assert.AreEqual(36000000000L, d2.Delta.Ticks, "B08"); DateTime d3 = new DateTime (2002,2,25); Assert.AreEqual(false, t1.IsDaylightSavingTime (d3), "B09"); DateTime d4 = new DateTime (2002,4,8); Assert.AreEqual(true, t1.IsDaylightSavingTime (d4), "B10"); DateTime d5 = new DateTime (2002,11,4); Assert.AreEqual(false, t1.IsDaylightSavingTime (d5), "B11"); Assert.AreEqual(-180000000000L, t1.GetUtcOffset (d3).Ticks, "B12"); Assert.AreEqual(-144000000000L, t1.GetUtcOffset (d4).Ticks, "B13"); Assert.AreEqual(-180000000000L, t1.GetUtcOffset (d5).Ticks, "B14"); // Test TimeZone methods with UTC DateTime in DST. DateTime d6 = d4.ToUniversalTime (); Assert.AreEqual(false, t1.IsDaylightSavingTime (d6), "B15"); Assert.AreEqual(0, t1.GetUtcOffset (d6).Ticks, "B16"); }
/// <summary> /// Initializes a new instance of the <see cref="ProlificDataFileInfo"/> struct. /// </summary> /// <param name="fileManagerID">The string identifying the <see cref="ProlificDataFileManager"/> instance.</param> /// <param name="appInstanceID">The string identifying the current application instance.</param> /// <param name="creationTime">The creation time of the file based on it's name.</param> /// <param name="fileExtension">The optional file extension, or <c>null</c>.</param> /// <param name="dataStoreName">The data store name used to access the file through the abstract file system.</param> public ProlificDataFileInfo( string fileManagerID, string appInstanceID, DateTime creationTime, string fileExtension, string dataStoreName ) { try { if( fileManagerID.NullOrLengthy() ) throw new ArgumentException("Bad argument: fileManagerID").StoreFileLine(); if( appInstanceID.NullOrLengthy() ) throw new ArgumentException("Bad argument: appInstanceID").StoreFileLine(); if( creationTime.Kind == DateTimeKind.Unspecified ) throw new ArgumentException("Unspecified DateTimeKind is not supported!").StoreFileLine(); if( !DataStore.IsValidName(dataStoreName) ) throw new ArgumentException("Bad argument: dataStoreName").StoreFileLine(); this.fileManagerID = fileManagerID; this.appInstanceID = appInstanceID; this.creationTime = creationTime.ToUniversalTime(); this.fileExtension = fileExtension.NullReference() ? string.Empty : fileExtension; this.dataStoreName = dataStoreName; } catch( Exception ex ) { ex.Store("fileManagerID", fileManagerID); ex.Store("appInstanceID", appInstanceID); ex.Store("creationTime", creationTime); ex.Store("fileExtension", fileExtension); ex.Store("dataStoreName", dataStoreName); throw; } }
public void DataTypes_Resolver_DateTime_TuesAt12PM_UtcInput() { var today = new System.DateTime(2019, 12, 05); var resolution = TimexResolver.Resolve(new[] { "XXXX-WXX-2T12" }, today.ToUniversalTime()); Assert.AreEqual(2, resolution.Values.Count); var previousWeekLocal = new System.DateTime(2019, 12, 03, 12, 0, 0, System.DateTimeKind.Local); var previousWeekUtc = previousWeekLocal.ToUniversalTime(); Assert.AreEqual("XXXX-WXX-2T12", resolution.Values[0].Timex); Assert.AreEqual("datetime", resolution.Values[0].Type); Assert.AreEqual(previousWeekUtc.ToString("yyyy-MM-dd HH:mm:ss"), resolution.Values[0].Value); Assert.IsNull(resolution.Values[0].Start); Assert.IsNull(resolution.Values[0].End); var nextWeekLocal = new System.DateTime(2019, 12, 10, 12, 0, 0, System.DateTimeKind.Local); var nextWeekUtc = nextWeekLocal.ToUniversalTime(); Assert.AreEqual("XXXX-WXX-2T12", resolution.Values[1].Timex); Assert.AreEqual("datetime", resolution.Values[1].Type); Assert.AreEqual(nextWeekUtc.ToString("yyyy-MM-dd HH:mm:ss"), resolution.Values[1].Value); Assert.IsNull(resolution.Values[1].Start); Assert.IsNull(resolution.Values[1].End); }
private static string ConvertExpires(System.DateTime expires) { System.DateTime utc = expires.ToUniversalTime(); string s = utc.DayOfWeek + ", " + utc.Day + "-" + GetMonth(utc.Month) + "-" + utc.Year + " " + utc.Hour + ":" + utc.Minute + ":" + utc.Second + " GMT"; return(s); }
internal PersonalizationStateInfo(string path, DateTime lastUpdatedDate, int size) { this._path = StringUtil.CheckAndTrimString(path, "path"); PersonalizationProviderHelper.CheckNegativeInteger(size, "size"); this._lastUpdatedDate = lastUpdatedDate.ToUniversalTime(); this._size = size; }
/// <summary> /// 1970年1月1日0時0分0秒からの経過秒を取得する /// </summary> /// <returns>経過秒</returns> internal protected static long GetClientTime() { System.DateTime utc = System.DateTime.UtcNow; utc = utc.ToUniversalTime(); System.TimeSpan timeSpan = utc - UNIX_EPOCH; return(( long )timeSpan.TotalSeconds); }
public static int ToInt32(DateTime dateTime) { if (dateTime.Kind != DateTimeKind.Utc) dateTime = dateTime.ToUniversalTime(); return (int)dateTime.Subtract(Epoch).TotalSeconds; }
/// <summary> /// Returns a new DateTime object set to the provided time /// but with precision limited to milliseconds. /// </summary> /// <param name="myTime"></param> /// <returns></returns> DateTime GetTimeStamp ( DateTime myTime ) { DateTime myUniversalTime = myTime.ToUniversalTime(); DateTime myNewTime = new DateTime(myUniversalTime.Year, myUniversalTime.Month, myUniversalTime.Day, myUniversalTime.Hour, myUniversalTime.Minute, myUniversalTime.Second, myUniversalTime.Millisecond); return myNewTime; }
public static long ToInt64(DateTime dateTime) { if (dateTime.Kind != DateTimeKind.Utc) dateTime = dateTime.ToUniversalTime(); return (long)dateTime.Subtract(Epoch).TotalSeconds; }
/// <summary> /// Millis the time stamp. /// </summary> /// <param name="theDate">The date.</param> /// <returns></returns> public static long MilliTimeStamp(DateTime theDate) { DateTime d1 = new DateTime(1970, 1, 1); DateTime d2 = theDate.ToUniversalTime(); TimeSpan ts = new TimeSpan(d2.Ticks - d1.Ticks); return (long)ts.TotalMilliseconds; }
/// <summary> /// Sets the system time for Linux systems. /// </summary> /// <param name="dateTime">The <see cref="DateTime"/></param> internal static void LinuxSetSystemTime(DateTime dateTime) { var dateTimeString = dateTime.ToUniversalTime().ToString("MM/dd/yyyy HH:mm:ss"); var startInfo = new ProcessStartInfo("/bin/date", $@"--utc --set=""{dateTimeString}""") { UseShellExecute = false, RedirectStandardOutput = true, RedirectStandardError = true }; var process = Process.Start(startInfo); process.StandardOutput.DiscardToEnd(); process.StandardError.DiscardToEnd(); process.WaitForExit(); startInfo = new ProcessStartInfo("/sbin/hwclock", "--utc --systohc"); startInfo.UseShellExecute = false; startInfo.RedirectStandardOutput = true; startInfo.RedirectStandardError = true; process = Process.Start(startInfo); process.StandardOutput.DiscardToEnd(); process.StandardError.DiscardToEnd(); process.WaitForExit(); }
/// <summary> /// Datetime转Json时间,datetime - 1970.1.1 /// </summary> /// <param name="dt"></param> /// <returns></returns> public static int UnixTicks(DateTime dt) { DateTime d1 = new DateTime(1970, 1, 1); DateTime d2 = dt.ToUniversalTime(); TimeSpan ts = new TimeSpan(d2.Ticks - d1.Ticks); return (int)ts.TotalSeconds; }
//android.permission.WRITE_CALENDAR public void AddAppointment(DateTime startTime, DateTime endTime, String subject, String location, String details, Boolean isAllDay, AppointmentReminder reminder, AppointmentStatus status) { ContentValues eventValues = new ContentValues(); eventValues.Put(CalendarContract.Events.InterfaceConsts.CalendarId, 1); //_calId); eventValues.Put(CalendarContract.Events.InterfaceConsts.Title, subject); eventValues.Put(CalendarContract.Events.InterfaceConsts.Description, details); eventValues.Put(CalendarContract.Events.InterfaceConsts.Dtstart, startTime.ToUniversalTime().ToString()); // GetDateTimeMS(2011, 12, 15, 10, 0)); eventValues.Put(CalendarContract.Events.InterfaceConsts.Dtend, endTime.ToUniversalTime().ToString()); // GetDateTimeMS(2011, 12, 15, 11, 0)); eventValues.Put(CalendarContract.Events.InterfaceConsts.EventTimezone, "UTC"); eventValues.Put(CalendarContract.Events.InterfaceConsts.EventEndTimezone, "UTC"); eventValues.Put(CalendarContract.Events.InterfaceConsts.Availability, ConvertAppointmentStatus(status)); eventValues.Put(CalendarContract.Events.InterfaceConsts.EventLocation, location); eventValues.Put(CalendarContract.Events.InterfaceConsts.AllDay, (isAllDay) ? "1" : "0"); eventValues.Put(CalendarContract.Events.InterfaceConsts.HasAlarm, "1"); var eventUri = CalendarConnector.Activity.ContentResolver.Insert(CalendarContract.Events.ContentUri, eventValues); long eventID = long.Parse(eventUri.LastPathSegment); ContentValues remindervalues = new ContentValues(); remindervalues.Put(CalendarContract.Reminders.InterfaceConsts.Minutes, ConvertReminder(reminder)); remindervalues.Put(CalendarContract.Reminders.InterfaceConsts.EventId, eventID); remindervalues.Put(CalendarContract.Reminders.InterfaceConsts.Method, (int)RemindersMethod.Alert); var reminderURI = CalendarConnector.Activity.ContentResolver.Insert(CalendarContract.Reminders.ContentUri, remindervalues); }
/// <summary>Writes the last sync time to the SyncStateFile</summary> public static void StoreLastSyncTime(string datasetName, DateTime syncTime) { string syncStateFile = SyncStateFile(); StringBuilder stringBuilder = new StringBuilder(); bool fileUpdateInfoFound = false; if (File.Exists(syncStateFile)) { foreach (string line in EnumerateFileLines(syncStateFile)) { if (LineContainsDatasetName(line, datasetName)) { stringBuilder.AppendLine(datasetName + _SYNC_STATE_DELIM + syncTime.ToUniversalTime().ToString("u")); fileUpdateInfoFound = true; } else { stringBuilder.AppendLine(line); } } } if (!fileUpdateInfoFound) stringBuilder.AppendLine(datasetName + _SYNC_STATE_DELIM + syncTime.ToUniversalTime().ToString("u")); using (StreamWriter streamWriter = CreateTextFile(syncStateFile)) { streamWriter.Write(stringBuilder.ToString()); } }
private void CET (TimeZone t1) { Assert.AreEqual("CET", t1.StandardName, "A01"); Assert.AreEqual("CEST", t1.DaylightName, "A02"); DaylightTime d1 = t1.GetDaylightChanges (2002); Assert.AreEqual("03/31/2002 02:00:00", d1.Start.ToString ("G", CultureInfo.InvariantCulture), "A03"); Assert.AreEqual("10/27/2002 03:00:00", d1.End.ToString ("G", CultureInfo.InvariantCulture), "A04"); Assert.AreEqual(36000000000L, d1.Delta.Ticks, "A05"); DaylightTime d2 = t1.GetDaylightChanges (1996); Assert.AreEqual("03/31/1996 02:00:00", d2.Start.ToString ("G", CultureInfo.InvariantCulture), "A06"); Assert.AreEqual("10/27/1996 03:00:00", d2.End.ToString ("G", CultureInfo.InvariantCulture), "A07"); Assert.AreEqual(36000000000L, d2.Delta.Ticks, "A08"); DateTime d3 = new DateTime (2002,2,25); Assert.AreEqual(false, t1.IsDaylightSavingTime (d3), "A09"); DateTime d4 = new DateTime (2002,4,2); Assert.AreEqual(true, t1.IsDaylightSavingTime (d4), "A10"); DateTime d5 = new DateTime (2002,11,4); Assert.AreEqual(false, t1.IsDaylightSavingTime (d5), "A11"); Assert.AreEqual(36000000000L, t1.GetUtcOffset (d3).Ticks, "A12"); Assert.AreEqual(72000000000L, t1.GetUtcOffset (d4).Ticks, "A13"); Assert.AreEqual(36000000000L, t1.GetUtcOffset (d5).Ticks, "A14"); // Test TimeZone methods with UTC DateTime in DST. DateTime d6 = d4.ToUniversalTime (); Assert.AreEqual(false, t1.IsDaylightSavingTime (d6), "A15"); Assert.AreEqual(0, t1.GetUtcOffset (d6).Ticks, "A16"); }
/// <summary> /// Converts a DateTime to UTC long /// </summary> /// <param name="from">The DateTime to convert</param> /// <returns>The long representation of the UTC</returns> public static long AsLocal(System.DateTime from) { System.DateTime now = System.DateTime.Now; TimeSpan diff = now - now.ToUniversalTime(); return(Convert(from - diff)); }
public static System.DateTime ToUniversalTime(System.DateTime value) { if (value.Kind == System.DateTimeKind.Utc) { return(value); } return(value.ToUniversalTime()); }
public static double DateTimeToSecondsSinceEpoch(System.DateTime inDateTime) { // Taking universal time into account System.DateTime universalDate = inDateTime.ToUniversalTime(); System.TimeSpan timeSpan = new System.TimeSpan(universalDate.Ticks - EpochDateTime.Ticks); return(timeSpan.TotalSeconds); }
private static DateTime ParseRFC822DateNow(string dateString, DateTime defaultDate) { bool bolSuccess = false; System.DateTime dteParsedDate = default(System.DateTime); int intLastSpaceIndex = dateString.LastIndexOf(" "); // First, try to parse the date with .NET's engine try { // Parse date dteParsedDate = System.DateTime.Parse(dateString, DateTimeFormatInfo.InvariantInfo); // Set to UTC if GMT or Z timezone info is given if (dateString.Substring(intLastSpaceIndex + 1) == "GMT" | dateString.Substring(intLastSpaceIndex + 1) == "Z") { dteParsedDate.ToUniversalTime(); } bolSuccess = true; } catch (Exception) { // Parsing failed, mark to try it "by hand" bolSuccess = false; } if (!bolSuccess) { // Try a manual parse now without timezone information string strTimezone = dateString.Substring(intLastSpaceIndex + 1); string strReducedDate = dateString.Substring(0, intLastSpaceIndex); dteParsedDate = System.DateTime.Parse(strReducedDate, DateTimeFormatInfo.InvariantInfo); // Now, calculate UTC based on the given timezone in the date string if (strTimezone.StartsWith("+")) { // The Timezone is given as a +hhmm string dteParsedDate.AddHours(-int.Parse(strReducedDate.Substring(1, 2))); dteParsedDate.AddMinutes(-int.Parse(strReducedDate.Substring(3))); } else if (strTimezone.StartsWith("-")) { // The Timezone is given as a -hhmm string // The Timezone is given as a +hhmm string dteParsedDate.AddHours(int.Parse(strReducedDate.Substring(1, 2))); dteParsedDate.AddMinutes(int.Parse(strReducedDate.Substring(3))); } else { // The Timezone is given as a named string dteParsedDate = dteParsedDate.AddHours(GetHoursByCode(strTimezone)); } } return(dteParsedDate); }
/// <summary> /// Convert the string found in the xmltv file into a DateTime object in UTC time /// </summary> /// <param name="theDateTimeStr">The xmltv string representing the DateTime</param> /// <returns>A new DateTime object in UTC time</returns> static DateTime DateTimefromXMLTVNZFormat(string theDateTimeStr) { // fix this - it is really ugly DateTime theDateTime = new System.DateTime(Int32.Parse(theDateTimeStr.Substring(0, 4)), Int32.Parse(theDateTimeStr.Substring(4, 2)), Int32.Parse(theDateTimeStr.Substring(6, 2)), Int32.Parse(theDateTimeStr.Substring(8, 2)), Int32.Parse(theDateTimeStr.Substring(10, 2)), Int32.Parse(theDateTimeStr.Substring(12, 2))); theDateTime = theDateTime.ToUniversalTime(); return(theDateTime); }
/// <summary> /// 将c# DateTime时间格式转换为Unix时间戳格式 /// </summary> /// <param name="time"></param> /// <returns></returns> public static int ConvertDateTimeToUnixTime(System.DateTime time) { int intResult = 0; System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1)); //intResult =Convert.ToInt32((time.ToUniversalTime().Ticks - startTime.ToUniversalTime().Ticks) / 10000000); intResult = Convert.ToInt32((time.ToUniversalTime().Ticks - 621355968000000000) / 10000000); return(intResult); }
/// <summary> /// 时间对象转时间戳,单位毫秒 /// </summary> /// <param name="date"></param> /// <returns></returns> public long GetTimestampMSFromDate(System.DateTime date) { //这种情况下,是0时区的本地时间 if (date.Kind == DateTimeKind.Utc) return (long)date.Subtract(s_dateTime1970).TotalMilliseconds; //这种情况下,可能是客户端时区(Kind为Local),也可能是服务端时区(Unspecified) else return (long)date.ToUniversalTime().Subtract(s_dateTime1970).TotalMilliseconds; }
private void DXClusterMenuClick_Click(object sender, EventArgs e) { try { DataGridViewRow row = dataGridQSOLog.SelectedRows[0]; DataGridViewCellCollection cells = row.Cells; string msg = ""; System.DateTime date = DateTime.UtcNow; if (MainForm.telnet_server != null && MainForm.telnet_server.run_server) { msg = "DX DE " + MainForm.SetupForm.txtStnCALL.Text + " " + cells["Freq"].Value.ToString() + " " + cells["CALL"].Value.ToString() + " " + cells["Mode"].Value.ToString(); string Info = (string)cells["Info"].Value; if (Info.StartsWith("CQ")) { msg += " " + Info; } string time = date.ToUniversalTime().ToShortTimeString(); time = time.Replace(":", ""); if (time.Length > 4) { time = time.Remove(3, 2); } msg = msg.PadRight(64, ' '); msg += " " + time + "Z"; MainForm.telnet_server.SendMessage(msg); } else { msg = "DX " + cells["Freq"].Value.ToString() + " " + cells["CALL"].Value.ToString() + " " + cells["Mode"].Value.ToString(); string Info = (string)cells["Info"].Value; if (Info.StartsWith("CQ")) { msg += " " + Info; } if (MainForm.DXClusterForm != null) { MainForm.DXClusterForm.SendClusterMessage(msg); } } } catch (Exception ex) { Debug.Write(ex.ToString()); } }
private static string CreateICal(string SendFrom, string SendTo, string Subject, string Body, string Location, System.DateTime StartTime, System.DateTime EndTime, string MsgID, int Sequence, bool IsCancelled) { StringBuilder sb = new StringBuilder(); if (string.IsNullOrEmpty(MsgID)) { MsgID = Guid.NewGuid().ToString(); } //See iCalendar spec here: http://tools.ietf.org/html/rfc2445 //Abridged version here: http://www.kanzaki.com/docs/ical/ sb.AppendLine("BEGIN:VCALENDAR"); sb.AppendLine("PRODID:-//Microsoft LightSwitch"); sb.AppendLine("VERSION:2.0"); if (IsCancelled) { sb.AppendLine("METHOD:CANCEL"); } else { sb.AppendLine("METHOD:REQUEST"); } sb.AppendLine("BEGIN:VEVENT"); if (IsCancelled) { sb.AppendLine("STATUS:CANCELLED"); sb.AppendLine("PRIORITY:1"); } sb.AppendLine(string.Format("ATTENDEE;RSVP=TRUE;ROLE=REQ-PARTICIPANT:MAILTO:{0}", SendTo)); sb.AppendLine(string.Format("ORGANIZER:MAILTO:{0}", SendFrom)); sb.AppendLine(string.Format("DTSTART:{0:yyyyMMddTHHmmssZ}", StartTime.ToUniversalTime())); sb.AppendLine(string.Format("DTEND:{0:yyyyMMddTHHmmssZ}", EndTime.ToUniversalTime())); sb.AppendLine(string.Format("LOCATION:{0}", Location)); sb.AppendLine("TRANSP:OPAQUE"); //You need to increment the sequence anytime you update the meeting request. sb.AppendLine(string.Format("SEQUENCE:{0}", Sequence)); //This needs to be a unique ID. A GUID is created when the appointment entity is inserted sb.AppendLine(string.Format("UID:{0}", MsgID)); sb.AppendLine(string.Format("DTSTAMP:{0:yyyyMMddTHHmmssZ}", DateTime.UtcNow)); sb.AppendLine(string.Format("DESCRIPTION:{0}", Body)); sb.AppendLine(string.Format("SUMMARY:{0}", Subject)); sb.AppendLine("CLASS:PUBLIC"); //Create a 15min reminder sb.AppendLine("BEGIN:VALARM"); sb.AppendLine("TRIGGER:-PT15M"); sb.AppendLine("ACTION:DISPLAY"); sb.AppendLine("DESCRIPTION:Reminder"); sb.AppendLine("END:VALARM"); sb.AppendLine("END:VEVENT"); sb.AppendLine("END:VCALENDAR"); return(sb.ToString()); }
public IHttpActionResult AddInvitation([FromBody] InvitationModel invitationModel) { //******* Create .ics file to add an event ********* string schLocation = "Invitation Location"; string schSubject = "Invitation"; string schDescription = "Invitation description"; System.DateTime schBeginDate = invitationModel.InvitationDateTime; //System.DateTime schEndDate = Convert.ToDateTime("18/2/2018 11:00:00 PM"); //PUTTING THE MEETING DETAILS INTO AN ARRAY OF STRING String[] contents = { "BEGIN:VCALENDAR", "PRODID:-//Flo Inc.//FloSoft//EN", "BEGIN:VEVENT", "DTSTART:" + schBeginDate.ToUniversalTime().ToString("yyyyMMdd\\THHmmss\\Z"), "DTEND:" + schBeginDate.ToUniversalTime().ToString("yyyyMMdd\\THHmmss\\Z"), "LOCATION:" + schLocation, "DESCRIPTION;ENCODING=QUOTED-PRINTABLE:" + schDescription, "SUMMARY:" + schSubject, "PRIORITY:3", "END:VEVENT", "END:VCALENDAR" }; /*THE METHOD 'WriteAllLines' CREATES A FILE IN THE SPECIFIED PATH WITH * THE SPECIFIED NAME,WRITES THE ARRAY OF CONTENTS INTO THE FILE AND CLOSES THE * FILE.SUPPOSE THE FILE ALREADY EXISTS IN THE SPECIFIED LOCATION,THE CONTENTS * IN THE FILE ARE OVERWRITTEN*/ // System.IO.File.WriteAllLines(Server.MapPath("Sample.ics"), contents); string datetimeNow = DateTime.Now.ToString("yyyyMMddHHmmss"); string fileName = "Invitation" + datetimeNow + ".ics"; System.IO.File.WriteAllLines(HttpContext.Current.Server.MapPath("~/InvitationsICS/" + fileName), contents); //********************************************* var invitationID = _invitationFacade.AddInvitation(Mapper.Map <InvitationDTO>(invitationModel), UserId, fileName); return(Ok(new InvitationModel { InvitationID = invitationID })); }
public static string GetStringFromDate(System.DateTime unespecifiedDate) { if (unespecifiedDate.Kind.Equals(DateTimeKind.Local)) { return(unespecifiedDate.ToLocalTime().ToString("d")); } System.DateTime localDateTime = System.TimeZoneInfo.ConvertTimeFromUtc(unespecifiedDate.ToUniversalTime(), TimeZoneInfo.Local); return(localDateTime.ToLocalTime().ToString("d")); }
public static long localBeiJingTime = 0;//北京时间和本地时间差 public static long nowMinis() { System.DateTime nowDate = System.DateTime.Now; System.DateTime d1 = new System.DateTime(1970, 1, 1); System.DateTime d2 = nowDate.ToUniversalTime(); System.TimeSpan ts = new System.TimeSpan(d2.Ticks - d1.Ticks); long ms = (long)ts.TotalMilliseconds; //返回 1970 年 1 月 1 日至今的毫秒数 return(ms); }
public static uint KeyCreateRandom() { RandomKeyMakeID++; /* MEMO: time(0) at C++ */ System.DateTime TimeNow = System.DateTime.Now; TimeNow.ToUniversalTime(); System.TimeSpan SecNow = TimeNow - TimeUnixEpoch; return(RandomKeyMakeID + (uint)SecNow.TotalSeconds); }
public void DataTypes_Resolver_DateTime_2021W02() // first day of the year is a Friday - week 2 { var today = new System.DateTime(2021, 01, 05); var resolution = TimexResolver.Resolve(new[] { "2021-W02" }, today.ToUniversalTime()); Assert.AreEqual(1, resolution.Values.Count); Assert.AreEqual("2021-W02", resolution.Values[0].Timex); Assert.AreEqual("daterange", resolution.Values[0].Type); Assert.AreEqual("2021-01-11", resolution.Values[0].Start); Assert.AreEqual("2021-01-18", resolution.Values[0].End); }
public void DataTypes_Resolver_DateTime_2024W01() // first day of the year is a Monday { var today = new System.DateTime(2024, 01, 01); var resolution = TimexResolver.Resolve(new[] { "2024-W01" }, today.ToUniversalTime()); Assert.AreEqual(1, resolution.Values.Count); Assert.AreEqual("2024-W01", resolution.Values[0].Timex); Assert.AreEqual("daterange", resolution.Values[0].Type); Assert.AreEqual("2024-01-01", resolution.Values[0].Start); Assert.AreEqual("2024-01-08", resolution.Values[0].End); }
public void DataTypes_Resolver_DateTime_2020W53() // has a 53-week year { var today = new System.DateTime(2020, 12, 30); var resolution = TimexResolver.Resolve(new[] { "2020-W53" }, today.ToUniversalTime()); Assert.AreEqual(1, resolution.Values.Count); Assert.AreEqual("2020-W53", resolution.Values[0].Timex); Assert.AreEqual("daterange", resolution.Values[0].Type); Assert.AreEqual("2020-12-28", resolution.Values[0].Start); Assert.AreEqual("2021-01-04", resolution.Values[0].End); }
/// <summary> /// Creates and returns a <b>DateTime</b> that represents either the /// local time now or its UTC equivalent. /// </summary> /// <param name="utc">Indicates if UTC time is required.</param> /// <returns>A new <b>DateTime</b> containing the current date and time.</returns> public static DateTime Now(bool utc) { System.DateTime now = System.DateTime.Now; if (utc) { now = now.ToUniversalTime(); } return(new DateTime( new DateValue(now.Day, now.Month, now.Year), new TimeValue(now.Hour, now.Minute, now.Second + now.Millisecond / 1000m), utc ? TimeZone.UTC : null)); }
public void AddValue(string name, System.DateTime value) { try { XmlNode node = m_document.SelectSingleNode(m_strSubkey); AppendSimpleValNode(node, name, "datetime", value.ToUniversalTime().ToString()); } catch (XPathException e) { Trace.WriteLine(" Error : " + e.Message); Trace.WriteLine(" XML : " + m_document.OuterXml); throw new Exception(" XPathException in Add Value " + e.Message); } }
// Converts a given System.DateTime object to DMTF datetime format. internal string ToDmtfDateTime(System.DateTime date) { string utcString = string.Empty; System.TimeSpan tickOffset = System.TimeZone.CurrentTimeZone.GetUtcOffset(date); long OffsetMins = ((long)((tickOffset.Ticks / System.TimeSpan.TicksPerMinute))); if ((System.Math.Abs(OffsetMins) > 999)) { date = date.ToUniversalTime(); utcString = "+000"; } else { if ((tickOffset.Ticks >= 0)) { utcString = string.Concat("+", ((System.Int64)((tickOffset.Ticks / System.TimeSpan.TicksPerMinute))).ToString().PadLeft(3, '0')); } else { string strTemp = ((System.Int64)(OffsetMins)).ToString(); utcString = string.Concat("-", strTemp.Substring(1, (strTemp.Length - 1)).PadLeft(3, '0')); } } string dmtfDateTime = ((System.Int32)(date.Year)).ToString().PadLeft(4, '0'); dmtfDateTime = string.Concat(dmtfDateTime, ((System.Int32)(date.Month)).ToString().PadLeft(2, '0')); dmtfDateTime = string.Concat(dmtfDateTime, ((System.Int32)(date.Day)).ToString().PadLeft(2, '0')); dmtfDateTime = string.Concat(dmtfDateTime, ((System.Int32)(date.Hour)).ToString().PadLeft(2, '0')); dmtfDateTime = string.Concat(dmtfDateTime, ((System.Int32)(date.Minute)).ToString().PadLeft(2, '0')); dmtfDateTime = string.Concat(dmtfDateTime, ((System.Int32)(date.Second)).ToString().PadLeft(2, '0')); dmtfDateTime = string.Concat(dmtfDateTime, "."); System.DateTime dtTemp = new System.DateTime(date.Year, date.Month, date.Day, date.Hour, date.Minute, date.Second, 0); long microsec = ((long)((((date.Ticks - dtTemp.Ticks) * 1000) / System.TimeSpan.TicksPerMillisecond))); string strMicrosec = ((System.Int64)(microsec)).ToString(); if ((strMicrosec.Length > 6)) { strMicrosec = strMicrosec.Substring(0, 6); } dmtfDateTime = string.Concat(dmtfDateTime, strMicrosec.PadLeft(6, '0')); dmtfDateTime = string.Concat(dmtfDateTime, utcString); return(dmtfDateTime); }
static StackObject *ToUniversalTime_10(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.GetObjectAndResolveReference(ptr_of_this_method); System.DateTime instance_of_this_method = (System.DateTime) typeof(System.DateTime).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags) 16); var result_of_this_method = instance_of_this_method.ToUniversalTime(); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); WriteBackInstance(__domain, ptr_of_this_method, __mStack, ref instance_of_this_method); __intp.Free(ptr_of_this_method); return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method)); }