ZFFramework
 
Loading...
Searching...
No Matches
ZFTime.h File Reference

time utility More...

#include "ZFObject.h"

Go to the source code of this file.

Classes

class  ZFTimeValue
 store a time value More...
 
class  v_ZFTimeValue
 type wrapper for ZFTypeId::Value More...
 
class  ZFTimeInfo
 store a time info, internal use only More...
 
class  v_ZFTimeInfo
 type wrapper for ZFTypeId::Value More...
 
class  ZFTime
 time utility More...
 

Macros

#define ZFSerializableKeyword_ZFTime_timeValue
 keyword for serialize
 
#define ZFSerializableKeyword_ZFTime_timeZone
 keyword for serialize
 
#define zftimetOneMinute
 in seconds
 
#define zftimetOneHour
 in seconds
 
#define zftimetOneDay
 in seconds
 
#define zftimetOneWeek
 in seconds
 
#define zftimetOneMonth
 30 days in seconds
 
#define zftimetOneYear
 365 days in seconds
 

Functions

const zfstringZFTypeId_ZFTimeValue (void)
 see ZFTYPEID_DECLARE
 
zfbool ZFTimeValueFromDataT (_ZFP_PropTypeW_ZFTimeValue &v, const ZFSerializableData &serializableData, zfstring *outErrorHint=zft_zfnull, ZFSerializableData *outErrorPos=zft_zfnull)
 see ZFTYPEID_DECLARE
 
_ZFP_PropTypeW_ZFTimeValue ZFTimeValueFromData (const ZFSerializableData &serializableData, zfstring *outErrorHint=zft_zfnull, ZFSerializableData *outErrorPos=zft_zfnull)
 see ZFTYPEID_DECLARE
 
zfbool ZFTimeValueToDataT (ZFSerializableData &serializableData, _ZFP_PropTypeW_ZFTimeValue const &v, zfstring *outErrorHint=zft_zfnull)
 see ZFTYPEID_DECLARE
 
ZFSerializableData ZFTimeValueToData (_ZFP_PropTypeW_ZFTimeValue const &v, zfstring *outErrorHint=zft_zfnull)
 see ZFTYPEID_DECLARE
 
zfbool ZFTimeValueFromStringT (_ZFP_PropTypeW_ZFTimeValue &v, const zfchar *src, zfindex srcLen=((zfindex) -1), zfstring *errorHint=zft_zfnull)
 util method to convert ZFTimeValue from string
 
_ZFP_PropTypeW_ZFTimeValue ZFTimeValueFromString (const zfchar *src, zfindex srcLen=((zfindex) -1), zfstring *errorHint=zft_zfnull)
 util method to convert ZFTimeValue from string
 
zfbool ZFTimeValueToStringT (zfstring &s, _ZFP_PropTypeW_ZFTimeValue const &v, zfstring *errorHint=zft_zfnull)
 util method to convert ZFTimeValue to string
 
zfstring ZFTimeValueToString (_ZFP_PropTypeW_ZFTimeValue const &v, zfstring *errorHint=zft_zfnull)
 util method to convert ZFTimeValue to string
 
ZFTimeValue const & ZFTimeValueZero (void)
 a zero time value
 
ZFTimeValue ZFTimeValueCreate (zftimet sec, zftimet usec)
 make a time value
 
ZFTimeValue ZFTimeValueFromMiliSeconds (zftimet t)
 convert between ZFTimeValue and zftimet (in miliseconds)
 
zftimet ZFTimeValueToMiliSeconds (const ZFTimeValue &v)
 convert between ZFTimeValue and zftimet (in miliseconds)
 
void ZFTimeValueNormalize (ZFTimeValue &v)
 normalize time value
 
void ZFTimeValueDec (ZFTimeValue &result, const ZFTimeValue &tv1, const ZFTimeValue &tv2)
 return tv1 - tv2
 
ZFTimeValue ZFTimeValueDec (const ZFTimeValue &tv1, const ZFTimeValue &tv2)
 return tv1 - tv2
 
void ZFTimeValueInc (ZFTimeValue &result, const ZFTimeValue &tv1, const ZFTimeValue &tv2)
 return tv1 + tv2
 
ZFTimeValue ZFTimeValueInc (const ZFTimeValue &tv1, const ZFTimeValue &tv2)
 return tv1 + tv2
 
void ZFTimeValueMul (ZFTimeValue &result, const ZFTimeValue &tv, zfindex v)
 return tv * v
 
ZFTimeValue ZFTimeValueMul (const ZFTimeValue &tv, zfindex v)
 return tv * v
 
void ZFTimeValueDiv (ZFTimeValue &result, const ZFTimeValue &tv, zfindex v)
 return tv / v, assert fail if v is 0
 
ZFTimeValue ZFTimeValueDiv (const ZFTimeValue &tv, zfindex v)
 return tv / v, assert fail if v is 0
 
ZFCompareResult ZFTimeValueCompare (const ZFTimeValue &tv1, const ZFTimeValue &tv2)
 compare two ZFTimeValue
 
zfbool ZFTimeValueToStringFriendlyT (zfstring &s, ZFTimeValue const &v)
 convert ZFTimeValue to more readable string, see ZFTimeValueToString
 
zfstring ZFTimeValueToStringFriendly (ZFTimeValue const &v)
 see ZFTimeValueToStringFriendlyT
 
const zfstringZFTypeId_ZFTimeInfo (void)
 
ZFTimeInfo const & ZFTimeInfoZero (void)
 a zero time info (1970-01-01 00:00:00.000 000)
 
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 &microSecond)
 make a time info, you should make sure value is valid
 
zfbool ZFTimeInfoToStringT (zfstring &s, ZFTimeInfo const &v)
 convert ZFTimeInfo to string
 
zfstring ZFTimeInfoToString (ZFTimeInfo const &v)
 see ZFTimeInfoToStringT
 

Detailed Description

time utility

Function Documentation

◆ ZFTypeId_ZFTimeValue()

const zfstring & ZFTypeId_ZFTimeValue ( void )
inline

see ZFTYPEID_DECLARE

serializable data:

value="(0, 0)" // optional, 0 by default
/>
store a time value
Definition ZFTime.h:17


◆ ZFTimeValueFromMiliSeconds()

ZFTimeValue ZFTimeValueFromMiliSeconds ( zftimet t)
inline

convert between ZFTimeValue and zftimet (in miliseconds)

note, convert from ZFTimeValue to zftimet would lose accuracy

◆ ZFTimeValueToMiliSeconds()

zftimet ZFTimeValueToMiliSeconds ( const ZFTimeValue & v)
inline

convert between ZFTimeValue and zftimet (in miliseconds)

note, convert from ZFTimeValue to zftimet would lose accuracy

◆ ZFTimeValueCompare()

ZFCompareResult ZFTimeValueCompare ( const ZFTimeValue & tv1,
const ZFTimeValue & tv2 )
extern

compare two ZFTimeValue

See also
ZFCompareResult

◆ ZFTimeValueToStringFriendlyT()

zfbool ZFTimeValueToStringFriendlyT ( zfstring & s,
ZFTimeValue const & v )
extern

convert ZFTimeValue to more readable string, see ZFTimeValueToString

can't be converted back from string, usually for debug use only

◆ ZFTypeId_ZFTimeInfo()

const zfstring & ZFTypeId_ZFTimeInfo ( void )
inline