gwenhywfar 5.14.1
timestamp.c File Reference
#include "./timestamp_p.h"
#include <gwenhywfar/misc.h>
#include <gwenhywfar/debug.h>
#include "timestamp-t.c"
Include dependency graph for timestamp.c:

Go to the source code of this file.

Functions

static int _calcJulian (int y, int m, int d)
static void _setDate (GWEN_TIMESTAMP *tstamp, int year, int month, int day)
static void _setFromInt64 (GWEN_TIMESTAMP *tstamp, int64_t i)
static void _setTime (GWEN_TIMESTAMP *tstamp, int hour, int minute, int second)
static void _writeAsString (GWEN_TIMESTAMP *tstamp)
void GWEN_Timestamp_AddSeconds (GWEN_TIMESTAMP *tstamp, int seconds)
int GWEN_Timestamp_Compare (const GWEN_TIMESTAMP *tstamp1, const GWEN_TIMESTAMP *tstamp0)
GWEN_TIMESTAMPGWEN_Timestamp_dup (const GWEN_TIMESTAMP *tstampSrc)
void GWEN_Timestamp_free (GWEN_TIMESTAMP *tstamp)
GWEN_TIMESTAMPGWEN_Timestamp_fromDb (GWEN_DB_NODE *db)
GWEN_TIMESTAMPGWEN_Timestamp_fromGmTime (time_t ti)
GWEN_TIMESTAMPGWEN_Timestamp_fromInt64 (int64_t i)
GWEN_TIMESTAMPGWEN_Timestamp_fromLocalTime (time_t ti)
GWEN_TIMESTAMPGWEN_Timestamp_fromString (const char *s)
GWEN_TIMESTAMPGWEN_Timestamp_fromStructTm (const struct tm *ltm)
int GWEN_Timestamp_GetDay (const GWEN_TIMESTAMP *tstamp)
int GWEN_Timestamp_GetHour (const GWEN_TIMESTAMP *tstamp)
int GWEN_Timestamp_GetMinute (const GWEN_TIMESTAMP *tstamp)
int GWEN_Timestamp_GetMonth (const GWEN_TIMESTAMP *tstamp)
int GWEN_Timestamp_GetSecond (const GWEN_TIMESTAMP *tstamp)
const char * GWEN_Timestamp_GetString (const GWEN_TIMESTAMP *tstamp)
int GWEN_Timestamp_GetWeekDay (const GWEN_TIMESTAMP *tstamp)
int GWEN_Timestamp_GetYear (const GWEN_TIMESTAMP *tstamp)
GWEN_TIMESTAMPGWEN_Timestamp_new (int year, int month, int day, int hour, int minute, int second)
GWEN_TIMESTAMPGWEN_Timestamp_NowInGmTime ()
GWEN_TIMESTAMPGWEN_Timestamp_NowInLocalTime ()
void GWEN_Timestamp_SetDate (GWEN_TIMESTAMP *tstamp, int year, int month, int day)
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)
void GWEN_Timestamp_SetTime (GWEN_TIMESTAMP *tstamp, int hour, int minute, int second)
int GWEN_Timestamp_toDb (const GWEN_TIMESTAMP *tstamp, GWEN_DB_NODE *db)
int64_t GWEN_Timestamp_toInt64 (const GWEN_TIMESTAMP *tstamp)
time_t GWEN_Timestamp_toTimeT (const GWEN_TIMESTAMP *tstamp)

Function Documentation

◆ _calcJulian()

int _calcJulian ( int y,
int m,
int d )
static

Definition at line 339 of file timestamp.c.

Referenced by _setDate().

Here is the caller graph for this function:

◆ _setDate()

void _setDate ( GWEN_TIMESTAMP * tstamp,
int year,
int month,
int day )
static

Definition at line 349 of file timestamp.c.

References _calcJulian().

Referenced by GWEN_Timestamp_SetDate(), and GWEN_Timestamp_SetDateAndTime().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _setFromInt64()

void _setFromInt64 ( GWEN_TIMESTAMP * tstamp,
int64_t i )
static

Definition at line 123 of file timestamp.c.

References GWEN_Timestamp_SetJulianDate().

Referenced by GWEN_Timestamp_AddSeconds(), and GWEN_Timestamp_fromInt64().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ _setTime()

void _setTime ( GWEN_TIMESTAMP * tstamp,
int hour,
int minute,
int second )
static

Definition at line 359 of file timestamp.c.

Referenced by GWEN_Timestamp_SetDateAndTime(), and GWEN_Timestamp_SetTime().

Here is the caller graph for this function:

◆ _writeAsString()

void _writeAsString ( GWEN_TIMESTAMP * tstamp)
static

Definition at line 368 of file timestamp.c.

Referenced by GWEN_Timestamp_SetDate(), GWEN_Timestamp_SetDateAndTime(), GWEN_Timestamp_SetJulianDate(), and GWEN_Timestamp_SetTime().

Here is the caller graph for this function:

◆ GWEN_Timestamp_AddSeconds()

void GWEN_Timestamp_AddSeconds ( GWEN_TIMESTAMP * tstamp,
int seconds )

Definition at line 497 of file timestamp.c.

References _setFromInt64(), and GWEN_Timestamp_toInt64().

Referenced by GWEN_MsgRequest_SetTimestamps().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_Timestamp_Compare()

int GWEN_Timestamp_Compare ( const GWEN_TIMESTAMP * tstamp1,
const GWEN_TIMESTAMP * tstamp0 )

Definition at line 313 of file timestamp.c.

References GWEN_Timestamp_toInt64().

Here is the call graph for this function:

◆ GWEN_Timestamp_dup()

GWEN_TIMESTAMP * GWEN_Timestamp_dup ( const GWEN_TIMESTAMP * tstampSrc)

Definition at line 67 of file timestamp.c.

References GWEN_NEW_OBJECT, and NULL.

Referenced by GWEN_MsgRequest_SetTimestamps().

Here is the caller graph for this function:

◆ GWEN_Timestamp_free()

void GWEN_Timestamp_free ( GWEN_TIMESTAMP * tstamp)

Definition at line 81 of file timestamp.c.

References GWEN_FREE_OBJECT.

Referenced by GWEN_MsgRequest_free(), GWEN_MsgRequest_SetCreatedAt(), GWEN_MsgRequest_SetExpiresAt(), and GWEN_MsgRequest_SetTimestamps().

Here is the caller graph for this function:

◆ GWEN_Timestamp_fromDb()

GWEN_TIMESTAMP * GWEN_Timestamp_fromDb ( GWEN_DB_NODE * db)

Definition at line 474 of file timestamp.c.

References DBG_INFO, DBG_VERBOUS, GWEN_DB_GetCharValue(), GWEN_LOGDOMAIN, GWEN_Timestamp_fromString(), and NULL.

Here is the call graph for this function:

◆ GWEN_Timestamp_fromGmTime()

GWEN_TIMESTAMP * GWEN_Timestamp_fromGmTime ( time_t ti)

Definition at line 160 of file timestamp.c.

References GWEN_Timestamp_fromStructTm().

Here is the call graph for this function:

◆ GWEN_Timestamp_fromInt64()

GWEN_TIMESTAMP * GWEN_Timestamp_fromInt64 ( int64_t i)

Definition at line 112 of file timestamp.c.

References _setFromInt64(), GWEN_NEW_OBJECT, and NULL.

Here is the call graph for this function:

◆ GWEN_Timestamp_fromLocalTime()

GWEN_TIMESTAMP * GWEN_Timestamp_fromLocalTime ( time_t ti)

Definition at line 153 of file timestamp.c.

References GWEN_Timestamp_fromStructTm().

Here is the call graph for this function:

◆ GWEN_Timestamp_fromString()

GWEN_TIMESTAMP * GWEN_Timestamp_fromString ( const char * s)

Definition at line 413 of file timestamp.c.

References DBG_INFO, GWEN_LOGDOMAIN, GWEN_Timestamp_new(), and NULL.

Referenced by GWEN_Timestamp_fromDb().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_Timestamp_fromStructTm()

GWEN_TIMESTAMP * GWEN_Timestamp_fromStructTm ( const struct tm * ltm)

Definition at line 138 of file timestamp.c.

References GWEN_Timestamp_new(), and NULL.

Referenced by GWEN_Timestamp_fromGmTime(), GWEN_Timestamp_fromLocalTime(), GWEN_Timestamp_NowInGmTime(), and GWEN_Timestamp_NowInLocalTime().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_Timestamp_GetDay()

int GWEN_Timestamp_GetDay ( const GWEN_TIMESTAMP * tstamp)

Definition at line 277 of file timestamp.c.

◆ GWEN_Timestamp_GetHour()

int GWEN_Timestamp_GetHour ( const GWEN_TIMESTAMP * tstamp)

Definition at line 292 of file timestamp.c.

◆ GWEN_Timestamp_GetMinute()

int GWEN_Timestamp_GetMinute ( const GWEN_TIMESTAMP * tstamp)

Definition at line 299 of file timestamp.c.

◆ GWEN_Timestamp_GetMonth()

int GWEN_Timestamp_GetMonth ( const GWEN_TIMESTAMP * tstamp)

Definition at line 270 of file timestamp.c.

◆ GWEN_Timestamp_GetSecond()

int GWEN_Timestamp_GetSecond ( const GWEN_TIMESTAMP * tstamp)

Definition at line 306 of file timestamp.c.

◆ GWEN_Timestamp_GetString()

const char * GWEN_Timestamp_GetString ( const GWEN_TIMESTAMP * tstamp)

Definition at line 90 of file timestamp.c.

Referenced by GWEN_Timestamp_toDb().

Here is the caller graph for this function:

◆ GWEN_Timestamp_GetWeekDay()

int GWEN_Timestamp_GetWeekDay ( const GWEN_TIMESTAMP * tstamp)

Definition at line 284 of file timestamp.c.

◆ GWEN_Timestamp_GetYear()

int GWEN_Timestamp_GetYear ( const GWEN_TIMESTAMP * tstamp)

Definition at line 263 of file timestamp.c.

◆ GWEN_Timestamp_new()

GWEN_TIMESTAMP * GWEN_Timestamp_new ( int year,
int month,
int day,
int hour,
int minute,
int second )

Definition at line 55 of file timestamp.c.

References GWEN_NEW_OBJECT, GWEN_Timestamp_SetDateAndTime(), and NULL.

Referenced by GWEN_Timestamp_fromString(), and GWEN_Timestamp_fromStructTm().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_Timestamp_NowInGmTime()

GWEN_TIMESTAMP * GWEN_Timestamp_NowInGmTime ( void )

Definition at line 204 of file timestamp.c.

References GWEN_Timestamp_fromStructTm(), and NULL.

Here is the call graph for this function:

◆ GWEN_Timestamp_NowInLocalTime()

GWEN_TIMESTAMP * GWEN_Timestamp_NowInLocalTime ( void )

Definition at line 194 of file timestamp.c.

References GWEN_Timestamp_fromStructTm(), and NULL.

Referenced by GWEN_MsgRequest_SetTimestamps().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_Timestamp_SetDate()

void GWEN_Timestamp_SetDate ( GWEN_TIMESTAMP * tstamp,
int year,
int month,
int day )

Definition at line 225 of file timestamp.c.

References _setDate(), and _writeAsString().

Here is the call graph for this function:

◆ GWEN_Timestamp_SetDateAndTime()

void GWEN_Timestamp_SetDateAndTime ( GWEN_TIMESTAMP * tstamp,
int year,
int month,
int day,
int hour,
int minute,
int second )

Definition at line 214 of file timestamp.c.

References _setDate(), _setTime(), and _writeAsString().

Referenced by GWEN_Timestamp_new().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_Timestamp_SetJulianDate()

void GWEN_Timestamp_SetJulianDate ( GWEN_TIMESTAMP * tstamp,
int julian )

Definition at line 233 of file timestamp.c.

References _writeAsString().

Referenced by _setFromInt64().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_Timestamp_SetTime()

void GWEN_Timestamp_SetTime ( GWEN_TIMESTAMP * tstamp,
int hour,
int minute,
int second )

Definition at line 255 of file timestamp.c.

References _setTime(), and _writeAsString().

Here is the call graph for this function:

◆ GWEN_Timestamp_toDb()

int GWEN_Timestamp_toDb ( const GWEN_TIMESTAMP * tstamp,
GWEN_DB_NODE * db )

Definition at line 463 of file timestamp.c.

References GWEN_DB_FLAGS_OVERWRITE_VARS, GWEN_DB_SetCharValue(), and GWEN_Timestamp_GetString().

Here is the call graph for this function:

◆ GWEN_Timestamp_toInt64()

int64_t GWEN_Timestamp_toInt64 ( const GWEN_TIMESTAMP * tstamp)

Transform the given timestamp into a 64 bit value only to be used by GWEN_Timestamp_fromInt64(). No assumptions should be made about how this value is calculated.

Definition at line 97 of file timestamp.c.

Referenced by GWEN_Timestamp_AddSeconds(), and GWEN_Timestamp_Compare().

Here is the caller graph for this function:

◆ GWEN_Timestamp_toTimeT()

time_t GWEN_Timestamp_toTimeT ( const GWEN_TIMESTAMP * tstamp)

Definition at line 167 of file timestamp.c.

References NULL.