gwentime.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef GWEN_TIME_H
00030 #define GWEN_TIME_H
00031
00032
00033 #include <gwenhywfar/gwenhywfarapi.h>
00034 #include <gwenhywfar/types.h>
00035 #include <gwenhywfar/db.h>
00036 #include <time.h>
00037
00038
00039 #ifdef __cplusplus
00040 extern "C" {
00041 #endif
00042
00043 typedef struct GWEN_TIME GWEN_TIME;
00044
00045
00046 GWENHYWFAR_API int GWEN_Time_toDb(const GWEN_TIME *t, GWEN_DB_NODE *db);
00047 GWENHYWFAR_API GWEN_TIME *GWEN_Time_fromDb(GWEN_DB_NODE *db);
00048
00049
00050 GWENHYWFAR_API GWEN_TIME *GWEN_CurrentTime(void);
00051
00052 GWENHYWFAR_API GWEN_TIME *GWEN_Time_new(int year,
00053 int month,
00054 int day,
00055 int hour,
00056 int min,
00057 int sec,
00058 int inUtc);
00059
00093 GWENHYWFAR_API GWEN_TIME *GWEN_Time_fromString(const char *s,
00094 const char *tmpl);
00095
00096 GWENHYWFAR_API GWEN_TIME *GWEN_Time_fromUtcString(const char *s,
00097 const char *tmpl);
00098
00099 GWENHYWFAR_API int GWEN_Time_toString(const GWEN_TIME *t,
00100 const char *tmpl,
00101 GWEN_BUFFER *buf);
00102 GWENHYWFAR_API int GWEN_Time_toUtcString(const GWEN_TIME *t,
00103 const char *tmpl,
00104 GWEN_BUFFER *buf);
00105
00106
00110 GWENHYWFAR_API GWEN_TIME *GWEN_Time_fromSeconds(uint32_t s);
00111 GWENHYWFAR_API void GWEN_Time_free(GWEN_TIME *t);
00112 GWENHYWFAR_API GWEN_TIME *GWEN_Time_dup(const GWEN_TIME *t);
00113
00117 GWENHYWFAR_API uint32_t GWEN_Time_Seconds(const GWEN_TIME *t);
00118
00120 GWENHYWFAR_API double GWEN_Time_Milliseconds(const GWEN_TIME *t);
00121
00125 GWENHYWFAR_API double GWEN_Time_Diff(const GWEN_TIME *t1,
00126 const GWEN_TIME *t0);
00127
00131 GWENHYWFAR_API double GWEN_Time_DiffSeconds(const GWEN_TIME *t1,
00132 const GWEN_TIME *t0);
00133
00134
00135
00136
00137 GWENHYWFAR_API int GWEN_Time_Compare(const GWEN_TIME *t1, const GWEN_TIME *t0);
00138
00143 GWENHYWFAR_API int GWEN_Time_AddSeconds(GWEN_TIME *ti, uint32_t secs);
00144
00149 GWENHYWFAR_API int GWEN_Time_SubSeconds(GWEN_TIME *ti, uint32_t secs);
00150
00151
00155 GWENHYWFAR_API int GWEN_Time_GetBrokenDownTime(const GWEN_TIME *t,
00156 int *hours,
00157 int *mins,
00158 int *secs);
00159
00163 GWENHYWFAR_API int GWEN_Time_GetBrokenDownUtcTime(const GWEN_TIME *t,
00164 int *hours,
00165 int *mins,
00166 int *secs);
00167
00171 GWENHYWFAR_API int GWEN_Time_GetBrokenDownDate(const GWEN_TIME *t,
00172 int *days,
00173 int *month,
00174 int *year);
00175
00179 GWENHYWFAR_API int GWEN_Time_GetBrokenDownUtcDate(const GWEN_TIME *t,
00180 int *days,
00181 int *month,
00182 int *year);
00183
00188 GWENHYWFAR_API struct tm GWEN_Time_toTm(const GWEN_TIME *t);
00189
00193 GWENHYWFAR_API time_t GWEN_Time_toTime_t(const GWEN_TIME *t);
00194
00195
00196
00197 #ifdef __cplusplus
00198 }
00199 #endif
00200
00201
00202
00203 #endif
00204