Example #1
0
        public static TdrError.ErrorType tdrDate2Str(ref TdrVisualBuf buf, UInt32 date)
        {
            TdrError.ErrorType ret     = TdrError.ErrorType.TDR_NO_ERROR;
            TdrDate            tdrDate = new TdrDate();

            ret = tdrDate.parse(date);
            if (TdrError.ErrorType.TDR_NO_ERROR == ret)
            {
                ret = buf.sprintf("{0:d4}-{1:d2}-{2:d2}", tdrDate.nYear, tdrDate.bMon, tdrDate.bDay);
            }
            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_TDRDATE_VALUE;
            }

            return(ret);
        }
Example #2
0
        public static TdrError.ErrorType tdrDate2Str(ref TdrVisualBuf buf, uint date)
        {
            TdrDate date2 = new TdrDate();

            if (date2.parse(date) == TdrError.ErrorType.TDR_NO_ERROR)
            {
                object[] args = new object[] { date2.nYear, date2.bMon, date2.bDay };
                return(buf.sprintf("{0:d4}-{1:d2}-{2:d2}", args));
            }
            return(TdrError.ErrorType.TDR_ERR_INVALID_TDRDATE_VALUE);
        }
Example #3
0
        public TdrError.ErrorType parse(ulong datetime)
        {
            TdrError.ErrorType ret = TdrError.ErrorType.TDR_NO_ERROR;

            uint date = (uint)(datetime & 0xFFFFFFFF);
            uint time = (uint)((datetime >> 32) & 0xFFFFFFFF);

            ret = tdrDate.parse(date);
            if (ret == TdrError.ErrorType.TDR_NO_ERROR)
            {
                ret = tdrTime.parse(time);
            }

            return(ret);
        }
Example #4
0
        public static TdrError.ErrorType tdrDate2Str(ref TdrVisualBuf buf, uint date)
        {
            TdrDate tdrDate = new TdrDate();

            TdrError.ErrorType result;
            if (tdrDate.parse(date) == TdrError.ErrorType.TDR_NO_ERROR)
            {
                result = buf.sprintf("{0:d4}-{1:d2}-{2:d2}", new object[]
                {
                    tdrDate.nYear,
                    tdrDate.bMon,
                    tdrDate.bDay
                });
            }
            else
            {
                result = TdrError.ErrorType.TDR_ERR_INVALID_TDRDATE_VALUE;
            }
            return(result);
        }