public static TdrError.ErrorType str2TdrTime(out UInt32 time, string strTime) { TdrError.ErrorType ret = TdrError.ErrorType.TDR_NO_ERROR; DateTime dt; TdrTime tdrTime = new TdrTime(); if (DateTime.TryParse(strTime, out dt)) { tdrTime.nHour = (short)dt.TimeOfDay.Hours; tdrTime.bMin = (byte)dt.TimeOfDay.Minutes; tdrTime.bSec = (byte)dt.TimeOfDay.Seconds; tdrTime.toTime(out time); } else { #if (DEBUG) StackTrace st = new StackTrace(true); for (int i = 0; i < st.FrameCount; i++) { if (null != st.GetFrame(i).GetFileName()) { Console.WriteLine(st.GetFrame(i).ToString()); } } #endif time = 0; ret = TdrError.ErrorType.TDR_ERR_INVALID_TDRTIME_VALUE; } return(ret); }
public void toDateTime(out ulong datetime) { uint date = 0; uint time = 0; tdrDate.toDate(out date); tdrTime.toTime(out time); datetime = ((ulong)date | (ulong)time << 32); }
public static TdrError.ErrorType str2TdrTime(out uint time, string strTime) { DateTime time2; TdrError.ErrorType type = TdrError.ErrorType.TDR_NO_ERROR; TdrTime time3 = new TdrTime(); if (DateTime.TryParse(strTime, out time2)) { time3.nHour = (short)time2.TimeOfDay.Hours; time3.bMin = (byte)time2.TimeOfDay.Minutes; time3.bSec = (byte)time2.TimeOfDay.Seconds; time3.toTime(out time); return(type); } time = 0; return(TdrError.ErrorType.TDR_ERR_INVALID_TDRTIME_VALUE); }
public static TdrError.ErrorType str2TdrTime(out uint time, string strTime) { TdrError.ErrorType result = TdrError.ErrorType.TDR_NO_ERROR; TdrTime tdrTime = new TdrTime(); DateTime dateTime; if (DateTime.TryParse(strTime, ref dateTime)) { tdrTime.nHour = (short)dateTime.get_TimeOfDay().get_Hours(); tdrTime.bMin = (byte)dateTime.get_TimeOfDay().get_Minutes(); tdrTime.bSec = (byte)dateTime.get_TimeOfDay().get_Seconds(); tdrTime.toTime(out time); } else { time = 0u; result = TdrError.ErrorType.TDR_ERR_INVALID_TDRTIME_VALUE; } return(result); }