Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        public static TdrError.ErrorType tdrTime2Str(ref TdrVisualBuf buf, UInt32 time)
        {
            TdrError.ErrorType ret = TdrError.ErrorType.TDR_NO_ERROR;
            TdrTime            tm  = new TdrTime();

            ret = tm.parse(time);
            if (TdrError.ErrorType.TDR_NO_ERROR == ret)
            {
                ret = buf.sprintf("{0:d2}:{1:d2}:{2:d2}", tm.nHour, tm.bMin, tm.bSec);
            }
            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
                ret = TdrError.ErrorType.TDR_ERR_INVALID_TDRTIME_VALUE;
            }

            return(ret);
        }
Esempio n. 3
0
 public TdrDateTime(ulong datetime)
 {
     tdrDate = new TdrDate((uint)(datetime & 0xFFFFFFFF));
     tdrTime = new TdrTime((uint)((datetime >> 32) & 0xFFFFFFFF));
 }
Esempio n. 4
0
 public TdrDateTime()
 {
     tdrDate = new TdrDate();
     tdrTime = new TdrTime();
 }