29#include "./timestamp_p.h"
31#include <gwenhywfar/misc.h>
32#include <gwenhywfar/debug.h>
56 int hour,
int minute,
int second)
92 return tstamp->asString;
103 ((int64_t)(tstamp->minute)*60)+
104 ((int64_t)(tstamp->hour)*60*60)+
105 ((int64_t)(tstamp->julian)*24*60*60);
144 ltm->tm_hour, ltm->tm_min, ltm->tm_sec);
176 memmove(&ti, tp,
sizeof(ti));
178 ti.tm_sec=tstamp->second;
179 ti.tm_min=tstamp->minute;
180 ti.tm_hour=tstamp->hour;
182 ti.tm_year=tstamp->year-1900;
183 ti.tm_mon=tstamp->month-1;
184 ti.tm_mday=tstamp->day;
188 assert(tt!=(time_t)-1);
215 int year,
int month,
int day,
216 int hour,
int minute,
int second)
219 _setTime(tstamp, hour, minute, second);
240 i=(4000*(l+1))/1461001;
244 tstamp->day=l-(2447*j)/80;
246 tstamp->month=j+2-(12*l);
247 tstamp->year=100*(n-49)+i+l;
248 tstamp->julian=julian;
257 _setTime(tstamp, hour, minute, second);
272 return tstamp->month;
293 return tstamp->minute;
300 return tstamp->second;
307 if (tstamp0 && tstamp1) {
333 return (1461*(y+4800+(m-14)/12))/4+
334 (367*(m-2-12*((m-14)/12)))/12-
335 (3*((y+4900+(m-14)/12)/100))/4+
354 tstamp->minute=minute;
355 tstamp->second=second;
365 ptr=tstamp->asString+14;
407 if (s && strlen(s)>=14) {
408 int year, month, day, hour, min, sec;
410 const char *originalPtr;
491 if (tstamp && seconds!=0) {
const char * GWEN_DB_GetCharValue(GWEN_DB_NODE *n, const char *path, int idx, const char *defVal)
int GWEN_DB_SetCharValue(GWEN_DB_NODE *n, uint32_t flags, const char *path, const char *val)
#define GWEN_DB_FLAGS_OVERWRITE_VARS
struct GWEN_DB_NODE GWEN_DB_NODE
#define DBG_VERBOUS(dbg_logger, format,...)
#define DBG_INFO(dbg_logger, format,...)
#define GWEN_FREE_OBJECT(varname)
#define GWEN_NEW_OBJECT(typ, varname)
static void _setFromInt64(GWEN_TIMESTAMP *tstamp, int64_t i)
int GWEN_Timestamp_Compare(const GWEN_TIMESTAMP *tstamp1, const GWEN_TIMESTAMP *tstamp0)
GWEN_TIMESTAMP * GWEN_Timestamp_fromLocalTime(time_t ti)
int GWEN_Timestamp_toDb(const GWEN_TIMESTAMP *tstamp, GWEN_DB_NODE *db)
int GWEN_Timestamp_GetMinute(const GWEN_TIMESTAMP *tstamp)
GWEN_TIMESTAMP * GWEN_Timestamp_fromGmTime(time_t ti)
void GWEN_Timestamp_SetDateAndTime(GWEN_TIMESTAMP *tstamp, int year, int month, int day, int hour, int minute, int second)
void GWEN_Timestamp_SetJulianDate(GWEN_TIMESTAMP *tstamp, int julian)
GWEN_TIMESTAMP * GWEN_Timestamp_fromString(const char *s)
GWEN_TIMESTAMP * GWEN_Timestamp_fromDb(GWEN_DB_NODE *db)
int GWEN_Timestamp_GetHour(const GWEN_TIMESTAMP *tstamp)
GWEN_TIMESTAMP * GWEN_Timestamp_new(int year, int month, int day, int hour, int minute, int second)
int GWEN_Timestamp_GetYear(const GWEN_TIMESTAMP *tstamp)
static void _setDate(GWEN_TIMESTAMP *tstamp, int year, int month, int day)
static int _calcJulian(int y, int m, int d)
int GWEN_Timestamp_GetSecond(const GWEN_TIMESTAMP *tstamp)
GWEN_TIMESTAMP * GWEN_Timestamp_dup(const GWEN_TIMESTAMP *tstampSrc)
const char * GWEN_Timestamp_GetString(const GWEN_TIMESTAMP *tstamp)
void GWEN_Timestamp_SetTime(GWEN_TIMESTAMP *tstamp, int hour, int minute, int second)
int GWEN_Timestamp_GetMonth(const GWEN_TIMESTAMP *tstamp)
GWEN_TIMESTAMP * GWEN_Timestamp_fromInt64(int64_t i)
void GWEN_Timestamp_AddSeconds(GWEN_TIMESTAMP *tstamp, int seconds)
static void _setTime(GWEN_TIMESTAMP *tstamp, int hour, int minute, int second)
int GWEN_Timestamp_GetDay(const GWEN_TIMESTAMP *tstamp)
void GWEN_Timestamp_SetDate(GWEN_TIMESTAMP *tstamp, int year, int month, int day)
void GWEN_Timestamp_free(GWEN_TIMESTAMP *tstamp)
static void _writeAsString(GWEN_TIMESTAMP *tstamp)
GWEN_TIMESTAMP * GWEN_Timestamp_NowInGmTime()
time_t GWEN_Timestamp_toTimeT(const GWEN_TIMESTAMP *tstamp)
GWEN_TIMESTAMP * GWEN_Timestamp_fromStructTm(const struct tm *ltm)
GWEN_TIMESTAMP * GWEN_Timestamp_NowInLocalTime()
int64_t GWEN_Timestamp_toInt64(const GWEN_TIMESTAMP *tstamp)
struct GWEN_TIMESTAMP GWEN_TIMESTAMP