00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #pragma once
00032 #ifndef __DBTIME_H__
00033 #define __DBTIME_H__
00034
00035 #include <time.h>
00036
00037 #include "CSDefs.h"
00038 #include "CSObject.h"
00039
00040 class CSTime : public CSObject {
00041 public:
00042 CSTime(): iIsNull(true) { }
00043 CSTime(s_int year, s_int mon, s_int day, s_int hour, s_int min, s_int sec, s_int nsec);
00044 virtual ~CSTime() { }
00045
00046 bool isNull();
00047
00048 void setNull();
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059 void setLocal(s_int year, s_int mon, s_int day, s_int hour, s_int min, s_int sec, s_int nsec);
00060
00061
00062 void getLocal(s_int& year, s_int& mon, s_int& day, s_int& hour, s_int& min, s_int& sec, s_int& nsec);
00063
00064
00065 void setUTC(s_int year, s_int mon, s_int day, s_int hour, s_int min, s_int sec, s_int nsec);
00066
00067
00068 void getUTC(s_int& year, s_int& mon, s_int& day, s_int& hour, s_int& min, s_int& sec, s_int& nsec);
00069
00070
00071
00072
00073
00074 char *getCString();
00075
00076
00077
00078
00079 char *getCString(const char *format);
00080
00081
00082
00083
00084 void setUTC1970(time_t sec, s_int nsec);
00085 void getUTC1970(time_t& sec, s_int& nsec);
00086
00087
00088
00089
00090 void setUTC1601(uint64_t nsec100);
00091 uint64_t getUTC1601();
00092
00093
00094
00095
00096 bool olderThen(time_t max_age);
00097
00098 static uint64_t getTimeCurrentTicks();
00099 private:
00100 bool iIsNull;
00101 char iCString[100];
00102
00103
00104 s_int iYear;
00105 s_int iMonth;
00106 s_int iDay;
00107 s_int iHours;
00108 s_int iMinutes;
00109 s_int iSeconds;
00110 s_int iNanoSeconds;
00111
00112 uint64_t get1970as1601();
00113 };
00114
00115 #endif