Exemple #1
0
        public static TdrError.ErrorType tdrTime2Str(ref TdrVisualBuf buf, uint time)
        {
            TdrTime time2 = new TdrTime();

            if (time2.parse(time) == TdrError.ErrorType.TDR_NO_ERROR)
            {
                object[] args = new object[] { time2.nHour, time2.bMin, time2.bSec };
                return(buf.sprintf("{0:d2}:{1:d2}:{2:d2}", args));
            }
            return(TdrError.ErrorType.TDR_ERR_INVALID_TDRTIME_VALUE);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        public static TdrError.ErrorType tdrTime2Str(ref TdrVisualBuf buf, uint time)
        {
            TdrTime tdrTime = new TdrTime();

            TdrError.ErrorType result;
            if (tdrTime.parse(time) == TdrError.ErrorType.TDR_NO_ERROR)
            {
                result = buf.sprintf("{0:d2}:{1:d2}:{2:d2}", new object[]
                {
                    tdrTime.nHour,
                    tdrTime.bMin,
                    tdrTime.bSec
                });
            }
            else
            {
                result = TdrError.ErrorType.TDR_ERR_INVALID_TDRTIME_VALUE;
            }
            return(result);
        }
Exemple #4
0
        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);
        }
Exemple #5
0
 public TdrDateTime(ulong datetime)
 {
     this.tdrDate = new TdrDate((uint)(datetime & (ulong)-1));
     this.tdrTime = new TdrTime((uint)(datetime >> 32 & (ulong)-1));
 }
Exemple #6
0
 public TdrDateTime()
 {
     this.tdrDate = new TdrDate();
     this.tdrTime = new TdrTime();
 }
Exemple #7
0
 public TdrDateTime(ulong datetime)
 {
     this.tdrDate = new TdrDate((uint)(datetime & 0xffffffffL));
     this.tdrTime = new TdrTime((uint)((datetime >> 0x20) & 0xffffffffL));
 }