gwenhywfar 5.12.0
timestamp.h
Go to the documentation of this file.
1/***************************************************************************
2 begin : Wed Mar 22 2023
3 copyright : (C) 2023 by Martin Preuss
4 email : martin@libchipcard.de
5
6 ***************************************************************************
7 * *
8 * This library is free software; you can redistribute it and/or *
9 * modify it under the terms of the GNU Lesser General Public *
10 * License as published by the Free Software Foundation; either *
11 * version 2.1 of the License, or (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
16 * Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public *
19 * License along with this library; if not, write to the Free Software *
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, *
21 * MA 02111-1307 USA *
22 * *
23 ***************************************************************************/
24
25
26#ifndef GWEN_TIMESTAMP_H
27#define GWEN_TIMESTAMP_H
28
29
30#include <gwenhywfar/testframework.h>
31
32#include <inttypes.h>
33#include <time.h>
34
35
37
38
39
40GWENHYWFAR_API GWEN_TIMESTAMP *GWEN_Timestamp_new(int year, int month, int day,
41 int hour, int minute, int second);
43
45
53
57
59
62
65
68
69
71 int year, int month, int day,
72 int hour, int minute, int second);
73
74GWENHYWFAR_API void GWEN_Timestamp_SetDate(GWEN_TIMESTAMP *tstamp, int year, int month, int day);
76GWENHYWFAR_API void GWEN_Timestamp_SetTime(GWEN_TIMESTAMP *tstamp, int hour, int minute, int second);
77
78
80
81GWENHYWFAR_API int GWEN_Timestamp_GetMonth(const GWEN_TIMESTAMP *tstamp); /* 1=Jan */
82
84
86
88
90
91
93
94
95
96GWENHYWFAR_API int GWEN_Timestamp_Compare(const GWEN_TIMESTAMP *tstamp1, const GWEN_TIMESTAMP *tstamp0);
97
98
100
101
102#endif
struct GWEN_DB_NODE GWEN_DB_NODE
Definition db.h:228
#define GWENHYWFAR_API
struct GWEN_TEST_MODULE GWEN_TEST_MODULE
Definition testmodule.h:65
GWENHYWFAR_API int GWEN_Timestamp_GetDay(const GWEN_TIMESTAMP *tstamp)
Definition timestamp.c:277
GWENHYWFAR_API GWEN_TIMESTAMP * GWEN_Timestamp_NowInGmTime(void)
Definition timestamp.c:204
GWENHYWFAR_API int64_t GWEN_Timestamp_toInt64(const GWEN_TIMESTAMP *tstamp)
Definition timestamp.c:97
GWENHYWFAR_API GWEN_TIMESTAMP * GWEN_Timestamp_dup(const GWEN_TIMESTAMP *tstamp)
Definition timestamp.c:67
GWENHYWFAR_API void GWEN_Timestamp_SetDateAndTime(GWEN_TIMESTAMP *tstamp, int year, int month, int day, int hour, int minute, int second)
Definition timestamp.c:214
GWENHYWFAR_API int GWEN_Timestamp_GetHour(const GWEN_TIMESTAMP *tstamp)
Definition timestamp.c:284
GWENHYWFAR_API GWEN_TIMESTAMP * GWEN_Timestamp_fromStructTm(const struct tm *ltm)
Definition timestamp.c:138
GWENHYWFAR_API int GWEN_Timestamp_toDb(const GWEN_TIMESTAMP *tstamp, GWEN_DB_NODE *db)
Definition timestamp.c:455
GWENHYWFAR_API void GWEN_Timestamp_SetJulianDate(GWEN_TIMESTAMP *tstamp, int julian)
Definition timestamp.c:233
GWENHYWFAR_API void GWEN_Timestamp_free(GWEN_TIMESTAMP *tstamp)
Definition timestamp.c:81
GWENHYWFAR_API GWEN_TIMESTAMP * GWEN_Timestamp_new(int year, int month, int day, int hour, int minute, int second)
Definition timestamp.c:55
GWENHYWFAR_API GWEN_TIMESTAMP * GWEN_Timestamp_NowInLocalTime(void)
Definition timestamp.c:194
GWENHYWFAR_API void GWEN_Timestamp_SetDate(GWEN_TIMESTAMP *tstamp, int year, int month, int day)
Definition timestamp.c:225
GWENHYWFAR_API const char * GWEN_Timestamp_GetString(const GWEN_TIMESTAMP *tstamp)
Definition timestamp.c:90
GWENHYWFAR_API void GWEN_Timestamp_AddSeconds(GWEN_TIMESTAMP *tstamp, int seconds)
Definition timestamp.c:489
GWENHYWFAR_API int GWEN_Timestamp_GetMinute(const GWEN_TIMESTAMP *tstamp)
Definition timestamp.c:291
GWENHYWFAR_API time_t GWEN_Timestamp_toTimeT(const GWEN_TIMESTAMP *tstamp)
Definition timestamp.c:167
GWENHYWFAR_API int GWEN_Timestamp_GetMonth(const GWEN_TIMESTAMP *tstamp)
Definition timestamp.c:270
GWENHYWFAR_API int GWEN_Timestamp_Compare(const GWEN_TIMESTAMP *tstamp1, const GWEN_TIMESTAMP *tstamp0)
Definition timestamp.c:305
GWENHYWFAR_API GWEN_TIMESTAMP * GWEN_Timestamp_fromInt64(int64_t i)
Definition timestamp.c:112
GWENHYWFAR_API int GWEN_Timestamp_GetYear(const GWEN_TIMESTAMP *tstamp)
Definition timestamp.c:263
struct GWEN_TIMESTAMP GWEN_TIMESTAMP
Definition timestamp.h:36
GWENHYWFAR_API GWEN_TIMESTAMP * GWEN_Timestamp_fromDb(GWEN_DB_NODE *db)
Definition timestamp.c:466
GWENHYWFAR_API int GWEN_Timestamp_AddTests(GWEN_TEST_MODULE *mod)
GWENHYWFAR_API int GWEN_Timestamp_GetSecond(const GWEN_TIMESTAMP *tstamp)
Definition timestamp.c:298
GWENHYWFAR_API GWEN_TIMESTAMP * GWEN_Timestamp_fromString(const char *s)
Definition timestamp.c:405
GWENHYWFAR_API GWEN_TIMESTAMP * GWEN_Timestamp_fromGmTime(time_t ti)
Definition timestamp.c:160
GWENHYWFAR_API void GWEN_Timestamp_SetTime(GWEN_TIMESTAMP *tstamp, int hour, int minute, int second)
Definition timestamp.c:255
GWENHYWFAR_API GWEN_TIMESTAMP * GWEN_Timestamp_fromLocalTime(time_t ti)
Definition timestamp.c:153