72 return (
zftimet)(v.sec * 1000 + v.usec / 1000);
90 result.sec = tv1.sec - tv2.sec;
91 result.usec = tv1.usec - tv2.usec;
114 result.
sec = tv1.sec + tv2.sec;
115 result.usec = tv1.usec + tv2.usec;
138 result.
sec = tv.sec * v;
139 result.usec = tv.usec * v;
257 ZFTimeInfo ret = {year, month, day, hour, minute, second, miliSecond, microSecond};
280#define ZFSerializableKeyword_ZFTime_timeValue "timeValue"
282#define ZFSerializableKeyword_ZFTime_timeZone "timeZone"
559 _ZFP_ZFTimePrivate *d;
577#define zftimetOneMinute() 60000LL
578#define zftimetOneHour() 3600000LL
579#define zftimetOneDay() 86400000LL
580#define zftimetOneWeek() 604800000LL
581#define zftimetOneMonth() 2592000000LL
582#define zftimetOneYear() 31536000000LL
#define ZFLIB_ZFCore
used to export symbols
Definition ZFCoreEnvDef.h:30
#define ZF_OUT_OPT
dummy macro that shows the param used as optional output
Definition ZFCoreTypeDef_ClassType.h:210
#define zfextend
dummy macro shows class inherit from another
Definition ZFCoreTypeDef_ClassType.h:53
#define zfoverride
dummy macro shows that method override parent's method
Definition ZFCoreTypeDef_ClassType.h:58
#define ZF_IN
dummy macro that shows the param used as required input
Definition ZFCoreTypeDef_ClassType.h:198
#define zfclassPOD
shows the class is a POD type
Definition ZFCoreTypeDef_ClassType.h:35
#define ZF_IN_OPT
dummy macro that shows the param used as optional input
Definition ZFCoreTypeDef_ClassType.h:202
#define ZF_OUT
dummy macro that shows the param used as required output
Definition ZFCoreTypeDef_ClassType.h:206
#define ZF_IN_OUT
dummy macro that shows the param used as required input and output
Definition ZFCoreTypeDef_ClassType.h:214
#define zfclassFwd
forward declaration of a class type
Definition ZFCoreTypeDef_ClassType.h:31
_ZFT_t_zfbool zfbool
bool type
Definition ZFCoreTypeDef_CoreType.h:103
_ZFT_t_zfindex zfindex
similar to size_t, used for index and size only
Definition ZFCoreTypeDef_CoreType.h:154
_ZFT_t_zfint zfint
same as int, see zfindex
Definition ZFCoreTypeDef_CoreType.h:165
_zft_zftimet zftimet
time unit, ensured at least 64 bit, ensured signed
Definition ZFCoreTypeDef_CoreType.h:203
_zft_zfidentity zfidentity
identity type, ensured at least 32 bit, ensured unsigned
Definition ZFCoreTypeDef_CoreType.h:225
#define zfnull
same as NULL, defined for future use
Definition ZFCoreTypeDef_CoreType.h:88
_ZFT_t_zfuint zfuint
same as unsigned int, see zfindex
Definition ZFCoreTypeDef_CoreType.h:169
#define ZFOUTPUT_TYPE_DECLARE(ZFLIB_, T_Type)
see ZFOUTPUT_TYPE
Definition ZFCoreTypeDef_OtherType.h:244
#define ZFOUTPUT_TYPE(T_Type, outputAction)
declare your custom type conversion to string, convenient for debug
Definition ZFCoreTypeDef_OtherType.h:221
ZFCompareResult
compare result of two ZFObjects
Definition ZFCoreTypeDef_OtherType.h:28
@ ZFCompareSmaller
Definition ZFCoreTypeDef_OtherType.h:30
@ ZFCompareEqual
Definition ZFCoreTypeDef_OtherType.h:31
@ ZFCompareGreater
Definition ZFCoreTypeDef_OtherType.h:32
zft_zfstring< zfchar > zfstring
see zft_zfstring
Definition ZFCoreTypeDef_StringType.h:15
#define ZFCORE_POD_DECLARE_NO_COMPARER(Type)
explicitly declare as POD
Definition ZFCoreUtilTemplate.h:565
#define ZFCORE_POD_DECLARE(Type)
explicitly declare as POD
Definition ZFCoreUtilTemplate.h:556
#define ZFEXPORT_VAR_READONLY_DECLARE(ZFLIB_, Type, Name)
see ZFEXPORT_VAR_DECLARE
Definition ZFExport.h:115
#define ZFMP_IN_OUT(ParamType, paramName)
see ZFMP_IN
Definition ZFMethod.h:117
#define ZFMP_OUT(ParamType, paramName)
see ZFMP_IN
Definition ZFMethod.h:111
#define ZFMP_IN_OPT(ParamType, paramName, DefaultValue)
see ZFMP_IN
Definition ZFMethod.h:108
#define ZFMP_IN(ParamType, paramName)
macro to wrap param types for ZFMETHOD_INLINE_0 series
Definition ZFMethod.h:105
#define ZFMETHOD_DECLARE_0(ReturnType, MethodName)
see ZFMethod
Definition ZFMethodDeclare.h:692
#define ZFMETHOD_DECLARE_STATIC_0(ReturnType, MethodName)
see ZFMethod
Definition ZFMethodDeclare.h:707
#define ZFMETHOD_DECLARE_2(ReturnType, MethodName, ZFMP_0, ZFMP_1)
see ZFMethod
Definition ZFMethodDeclare.h:1024
#define ZFMETHOD_DECLARE_STATIC_2(ReturnType, MethodName, ZFMP_0, ZFMP_1)
see ZFMethod
Definition ZFMethodDeclare.h:1041
#define ZFMETHOD_DECLARE_STATIC_1(ReturnType, MethodName, ZFMP_0)
see ZFMethod
Definition ZFMethodDeclare.h:869
#define ZFMETHOD_DECLARE_1(ReturnType, MethodName, ZFMP_0)
see ZFMethod
Definition ZFMethodDeclare.h:853
#define ZFMETHOD_FUNC_DECLARE_2(ZFLIB_, ReturnType, MethodName, ZFMP_0, ZFMP_1)
see ZFMETHOD_FUNC_DECLARE_0
Definition ZFMethodFuncDeclare.h:763
#define ZFMETHOD_FUNC_INLINE_DECLARE_2(ZFLIB_, ReturnType, MethodName, ZFMP_0, ZFMP_1)
see ZFMETHOD_FUNC_DECLARE_0
Definition ZFMethodFuncDeclare.h:835
#define ZFMETHOD_FUNC_INLINE_DECLARE_1(ZFLIB_, ReturnType, MethodName, ZFMP_0)
see ZFMETHOD_FUNC_DECLARE_0
Definition ZFMethodFuncDeclare.h:692
#define ZFMETHOD_FUNC_DECLARE_3(ZFLIB_, ReturnType, MethodName, ZFMP_0, ZFMP_1, ZFMP_2)
see ZFMETHOD_FUNC_DECLARE_0
Definition ZFMethodFuncDeclare.h:910
#define ZFMETHOD_FUNC_INLINE_DECLARE_8(ZFLIB_, ReturnType, MethodName, ZFMP_0, ZFMP_1, ZFMP_2, ZFMP_3, ZFMP_4, ZFMP_5, ZFMP_6, ZFMP_7)
see ZFMETHOD_FUNC_DECLARE_0
Definition ZFMethodFuncDeclare.h:1861
#define ZFMETHOD_FUNC_DECLARE_1(ZFLIB_, ReturnType, MethodName, ZFMP_0)
see ZFMETHOD_FUNC_DECLARE_0
Definition ZFMethodFuncDeclare.h:624
#define ZFMETHOD_FUNC_INLINE_DECLARE_3(ZFLIB_, ReturnType, MethodName, ZFMP_0, ZFMP_1, ZFMP_2)
see ZFMETHOD_FUNC_DECLARE_0
Definition ZFMethodFuncDeclare.h:986
#define ZF_NAMESPACE_GLOBAL_BEGIN
begin namespace ZFFramework
Definition ZFNamespace.h:97
#define ZF_NAMESPACE_GLOBAL_END
end namespace ZFFramework
Definition ZFNamespace.h:98
ZFObject related include.
#define zfclass
same as class, shows that this class is a ZFObject type
Definition ZFObjectClassTypeFwd.h:38
#define ZFOBJECT_ON_INIT_DECLARE_2(ZFMP_0, ZFMP_1)
see ZFOBJECT_ON_INIT_INLINE_1
Definition ZFObjectDeclare.h:286
#define ZFOBJECT_ON_INIT_DECLARE_1(ZFMP_0)
see ZFOBJECT_ON_INIT_INLINE_1
Definition ZFObjectDeclare.h:259
#define ZFOBJECT_DECLARE(ChildClass, SuperClass,...)
necessary for every class inherit from ZFObject
Definition ZFObjectDeclare.h:122
#define zfsuperI(T_SuperType)
class ref to proper super type, see ZFObject for more info
Definition ZFObjectDeclare.h:26
void ZFTimeValueDiv(ZFTimeValue &result, const ZFTimeValue &tv, zfindex v)
return tv / v, assert fail if v is 0
zftimet const & zftimetOneHour(void)
in mili seconds
Definition ZFTime.h:566
ZFCompareResult ZFTimeValueCompare(const ZFTimeValue &tv1, const ZFTimeValue &tv2)
compare two ZFTimeValue
zfbool ZFTimeInfoToStringT(zfstring &s, ZFTimeInfo const &v)
convert ZFTimeInfo to string
ZFTimeValue ZFTimeValueCreate(zftimet sec, zftimet usec)
make a time value
Definition ZFTime.h:48
void ZFTimeValueInc(ZFTimeValue &result, const ZFTimeValue &tv1, const ZFTimeValue &tv2)
return tv1 + tv2
Definition ZFTime.h:113
zftimet const & zftimetOneMonth(void)
30 days in mili seconds
Definition ZFTime.h:572
zfstring ZFTimeValueToStringFriendly(ZFTimeValue const &v)
see ZFTimeValueToStringFriendlyT
Definition ZFTime.h:195
ZFTimeValue ZFTimeValueFromMiliSeconds(zftimet t)
convert between ZFTimeValue and zftimet (in miliseconds)
Definition ZFTime.h:60
zfbool ZFTimeValueToStringT(zfstring &s, _ZFP_PropTypeW_ZFTimeValue const &v, zfstring *errorHint=zft_zfnull)
util method to convert ZFTimeValue to string
void ZFTimeValueMul(ZFTimeValue &result, const ZFTimeValue &tv, zfindex v)
return tv * v
Definition ZFTime.h:137
ZFTimeInfo const & ZFTimeInfoZero(void)
a zero time info (1970-01-01 00:00:00.000 000)
Definition ZFTime.h:243
zftimet const & zftimetOneMinute(void)
in mili seconds
Definition ZFTime.h:564
ZFTimeInfo ZFTimeInfoCreate(zfint const &year, zfuint const &month, zfuint const &day, zfuint const &hour, zfuint const &minute, zfuint const &second, zfuint const &miliSecond, zfuint const µSecond)
make a time info, you should make sure value is valid
Definition ZFTime.h:256
zftimet ZFTimeValueToMiliSeconds(const ZFTimeValue &v)
convert between ZFTimeValue and zftimet (in miliseconds)
Definition ZFTime.h:71
zftimet const & zftimetOneYear(void)
365 days in mili seconds
Definition ZFTime.h:574
zftimet const & zftimetOneDay(void)
in mili seconds
Definition ZFTime.h:568
zftimet const & zftimetOneWeek(void)
in mili seconds
Definition ZFTime.h:570
ZFTimeValue const & ZFTimeValueZero(void)
a zero time value
Definition ZFTime.h:41
zfbool ZFTimeValueToStringFriendlyT(zfstring &s, ZFTimeValue const &v)
convert ZFTimeValue to more readable string, see ZFTimeValueToString
void ZFTimeValueDec(ZFTimeValue &result, const ZFTimeValue &tv1, const ZFTimeValue &tv2)
return tv1 - tv2
Definition ZFTime.h:89
void ZFTimeValueNormalize(ZFTimeValue &v)
normalize time value
zfstring ZFTimeInfoToString(ZFTimeInfo const &v)
see ZFTimeInfoToStringT
Definition ZFTime.h:271
#define ZFTYPEID_DECLARE(ZFLIB_, TypeName, Type)
register a type for reflection
Definition ZFTypeIdDeclare.h:137
#define ZFTYPEID_ACCESS_ONLY_REG(ZFLIB_, TypeName, Type,...)
see ZFTYPEID_DECLARE
Definition ZFTypeIdDeclare.h:205
#define ZFTYPEID_ACCESS_ONLY_DECLARE(ZFLIB_, TypeName, Type)
see ZFTYPEID_DECLARE
Definition ZFTypeIdDeclare.h:195
#define ZFTYPEID_REG(ZFLIB_, TypeName, Type,...)
see ZFTYPEID_DECLARE
Definition ZFTypeIdDeclare.h:151
ZFUIMargin & operator+=(ZFUIMargin &v0, const ZFUIMargin &v1)
v0 += v1
Definition ZFUITypeDef.h:346
ZFUIMargin & operator-=(ZFUIMargin &v0, const ZFUIMargin &v1)
v0 -= v1
Definition ZFUITypeDef.h:402
ZFUIMargin operator+(const ZFUIMargin &v0, const ZFUIMargin &v1)
v0 + v1
Definition ZFUITypeDef.h:331
ZFUIMargin operator-(const ZFUIMargin &v0, const ZFUIMargin &v1)
v0 - v1
Definition ZFUITypeDef.h:387
ZFSerializable's data container, see ZFSerializable.
Definition ZFSerializableData.h:74
static zfbool timeInfoFromTimeValue(ZFTimeInfo &ti, const ZFTimeValue &tv)
convert time value to time info
virtual zfint year()
year since 0000, e.g. 2012
ZFTime zfself
class ref to self
Definition ZFTime.h:308
static zftimet currentTime()
equal to ZFTimeValueToMiliSeconds(currentTimeValue())
virtual const ZFTimeValue & timeValueAppliedTimeZone()
get time value which has been applied by time zone offset
virtual ZFCompareResult objectCompareImpl(ZFObject *anotherObj)
compared by timeValueAppliedTimeZone
static zftimet timestamp()
get timestamp in mili seconds
static zfint leapYearBetween(zfint year1, zfint year2)
return leap year num in range [year1, year2], may return negative value if (year1 > year2)
virtual zfuint day()
day of month range in [0, 27...30]
virtual zfbool timeInfo(zfint year, zfuint month, zfuint day, zfuint hour, zfuint minute, zfuint second, zfuint miliSecond, zfuint microSecond, const ZFTimeValue &tz=ZFTime::timeZoneLocal())
set time according to time info
virtual zfuint month()
month range in [0, 11]
static const ZFTimeValue & timeZoneLocal()
get current time zone
virtual zfbool serializableOnSerializeToData(ZFSerializableData &serializableData, zfstring *errorHint=zft_zfnull, ZFSerializable *refOwner=zft_zfnull)
corresponding to serializableOnSerializeFromData, return whether the task is success,...
virtual void objectInfoImplAppend(zfstring &ret)
see objectInfo
virtual void styleableOnCopyFrom(ZFObject *anotherStyleable)
for subclass to achieve custom style copy step, called by copyFrom, see ZFStyleable
Definition ZFTime.h:326
virtual zfbool timeZone(const ZFTimeValue &timeZone)
set time zone attched to this ZFTime object
virtual zfbool timeValue(const ZFTimeValue &tv)
set time according to time value
virtual void objectOnInit(ZFTime *time)
init from another ZFTime
virtual zfbool serializableOnSerializeFromData(const ZFSerializableData &serializableData, zfstring *errorHint=zft_zfnull, ZFSerializableData *errorPos=zft_zfnull)
for serializable data that has "category" attribute, ZFSerializable would ignore it and leave it to s...
virtual void objectOnDealloc(void)
override this to destroy your object
virtual zfuint hour()
hour range in [0, 23]
static zfbool timeInfoToTimeValue(ZFTimeValue &tv, const ZFTimeInfo &ti)
convert time info to time value
virtual zfuint minute()
minute range in [0, 59]
virtual zfuint microSecond()
microSecond range in [0, 999]
virtual zfuint second()
second range in [0, 59]
virtual zfidentity objectHashImpl(void)
see objectHash
virtual zfuint miliSecond()
miliSecond range in [0, 999]
static ZFTimeValue currentTimeValue()
return time since ZFTimeInfoZero, negative if before ZFTimeInfoZero
static ZFTimeInfo currentTimeInfo(const ZFTimeValue &localTimeZone=(ZFTime::timeZoneLocal()))
return current time info, util method to currentTimeValue
virtual zfuint dayOfWeek()
day of week range in [0, 6], while 0 stands for Sunday
virtual zfuint dayOfYear()
day of year range in [0, 364/365]
store a time info, internal use only
Definition ZFTime.h:223
zfint year
Definition ZFTime.h:225
zfuint microSecond
Definition ZFTime.h:232
zfuint day
Definition ZFTime.h:227
zfuint miliSecond
Definition ZFTime.h:231
zfuint minute
Definition ZFTime.h:229
zfuint hour
Definition ZFTime.h:228
zfuint month
Definition ZFTime.h:226
zfuint second
Definition ZFTime.h:230
store a time value
Definition ZFTime.h:17
zftimet usec
Definition ZFTime.h:20
zftimet sec
Definition ZFTime.h:19
#define zfcast(T_To, obj)
safely cast ZFObject types, return null if not desired type
Definition zfcast.h:24