gwentime.h
Go to the documentation of this file.
/***************************************************************************
$RCSfile$
-------------------
cvs : $Id$
begin : Wed Mar 24 2004
copyright : (C) 2004 by Martin Preuss
email : martin@libchipcard.de
***************************************************************************
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *
* License as published by the Free Software Foundation; either *
* version 2.1 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, *
* MA 02111-1307 USA *
* *
***************************************************************************/
#ifndef GWEN_TIME_H
#define GWEN_TIME_H
#include <gwenhywfar/gwenhywfarapi.h>
#include <gwenhywfar/types.h>
#include <gwenhywfar/db.h>
#include <time.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct GWEN_TIME GWEN_TIME;
GWENHYWFAR_API int GWEN_Time_toDb(const GWEN_TIME *t, GWEN_DB_NODE *db);
GWENHYWFAR_API GWEN_TIME *GWEN_Time_fromDb(GWEN_DB_NODE *db);
GWENHYWFAR_API GWEN_TIME *GWEN_CurrentTime(void);
GWENHYWFAR_API GWEN_TIME *GWEN_Time_new(int year,
int month,
int day,
int hour,
int min,
int sec,
int inUtc);
GWENHYWFAR_API GWEN_TIME *GWEN_Time_fromString(const char *s,
const char *tmpl);
GWENHYWFAR_API GWEN_TIME *GWEN_Time_fromUtcString(const char *s,
const char *tmpl);
GWENHYWFAR_API int GWEN_Time_toString(const GWEN_TIME *t,
const char *tmpl,
GWEN_BUFFER *buf);
GWENHYWFAR_API int GWEN_Time_toUtcString(const GWEN_TIME *t,
const char *tmpl,
GWEN_BUFFER *buf);
GWENHYWFAR_API GWEN_TIME *GWEN_Time_fromSeconds(uint32_t s);
GWENHYWFAR_API void GWEN_Time_free(GWEN_TIME *t);
GWENHYWFAR_API GWEN_TIME *GWEN_Time_dup(const GWEN_TIME *t);
GWENHYWFAR_API uint32_t GWEN_Time_Seconds(const GWEN_TIME *t);
GWENHYWFAR_API double GWEN_Time_Milliseconds(const GWEN_TIME *t);
GWENHYWFAR_API double GWEN_Time_Diff(const GWEN_TIME *t1,
const GWEN_TIME *t0);
GWENHYWFAR_API double GWEN_Time_DiffSeconds(const GWEN_TIME *t1,
const GWEN_TIME *t0);
/* Compare t1 and t0. Return 0 if both are equal, -1 if t1<t0 and
* 1 if t1>t0
*/
GWENHYWFAR_API int GWEN_Time_Compare(const GWEN_TIME *t1, const GWEN_TIME *t0);
GWENHYWFAR_API int GWEN_Time_AddSeconds(GWEN_TIME *ti, uint32_t secs);
GWENHYWFAR_API int GWEN_Time_SubSeconds(GWEN_TIME *ti, uint32_t secs);
GWENHYWFAR_API int GWEN_Time_GetBrokenDownTime(const GWEN_TIME *t,
int *hours,
int *mins,
int *secs);
GWENHYWFAR_API int GWEN_Time_GetBrokenDownUtcTime(const GWEN_TIME *t,
int *hours,
int *mins,
int *secs);
GWENHYWFAR_API int GWEN_Time_GetBrokenDownDate(const GWEN_TIME *t,
int *days,
int *month,
int *year);
GWENHYWFAR_API int GWEN_Time_GetBrokenDownUtcDate(const GWEN_TIME *t,
int *days,
int *month,
int *year);
#if 0
GWENHYWFAR_API struct tm GWEN_Time_toTm(const GWEN_TIME *t);
#endif
GWENHYWFAR_API time_t GWEN_Time_toTime_t(const GWEN_TIME *t);
#ifdef __cplusplus
}
#endif
#endif
db.h
GWEN_DB_NODE
struct GWEN_DB_NODE GWEN_DB_NODE
Definition db.h:228
GWEN_BUFFER
struct GWEN_BUFFER GWEN_BUFFER
A dynamically resizeable text buffer.
Definition buffer.h:38
gwenhywfarapi.h
GWENHYWFAR_API
#define GWENHYWFAR_API
Definition gwenhywfarapi.h:67
GWEN_Time_toDb
GWENHYWFAR_API int GWEN_Time_toDb(const GWEN_TIME *t, GWEN_DB_NODE *db)
GWEN_Time_fromString
GWENHYWFAR_API GWEN_TIME * GWEN_Time_fromString(const char *s, const char *tmpl)
GWEN_Time_DiffSeconds
GWENHYWFAR_API double GWEN_Time_DiffSeconds(const GWEN_TIME *t1, const GWEN_TIME *t0)
GWEN_TIME
struct GWEN_TIME GWEN_TIME
Definition gwentime.h:43
GWEN_Time_new
GWENHYWFAR_API GWEN_TIME * GWEN_Time_new(int year, int month, int day, int hour, int min, int sec, int inUtc)
GWEN_Time_Seconds
GWENHYWFAR_API uint32_t GWEN_Time_Seconds(const GWEN_TIME *t)
GWEN_Time_SubSeconds
GWENHYWFAR_API int GWEN_Time_SubSeconds(GWEN_TIME *ti, uint32_t secs)
GWEN_CurrentTime
GWENHYWFAR_API GWEN_TIME * GWEN_CurrentTime(void)
GWEN_Time_toString
GWENHYWFAR_API int GWEN_Time_toString(const GWEN_TIME *t, const char *tmpl, GWEN_BUFFER *buf)
GWEN_Time_fromDb
GWENHYWFAR_API GWEN_TIME * GWEN_Time_fromDb(GWEN_DB_NODE *db)
GWEN_Time_GetBrokenDownUtcTime
GWENHYWFAR_API int GWEN_Time_GetBrokenDownUtcTime(const GWEN_TIME *t, int *hours, int *mins, int *secs)
GWEN_Time_GetBrokenDownUtcDate
GWENHYWFAR_API int GWEN_Time_GetBrokenDownUtcDate(const GWEN_TIME *t, int *days, int *month, int *year)
GWEN_Time_toUtcString
GWENHYWFAR_API int GWEN_Time_toUtcString(const GWEN_TIME *t, const char *tmpl, GWEN_BUFFER *buf)
GWEN_Time_toTime_t
GWENHYWFAR_API time_t GWEN_Time_toTime_t(const GWEN_TIME *t)
GWEN_Time_fromUtcString
GWENHYWFAR_API GWEN_TIME * GWEN_Time_fromUtcString(const char *s, const char *tmpl)
GWEN_Time_free
GWENHYWFAR_API void GWEN_Time_free(GWEN_TIME *t)
GWEN_Time_dup
GWENHYWFAR_API GWEN_TIME * GWEN_Time_dup(const GWEN_TIME *t)
GWEN_Time_Compare
GWENHYWFAR_API int GWEN_Time_Compare(const GWEN_TIME *t1, const GWEN_TIME *t0)
GWEN_Time_Diff
GWENHYWFAR_API double GWEN_Time_Diff(const GWEN_TIME *t1, const GWEN_TIME *t0)
GWEN_Time_GetBrokenDownDate
GWENHYWFAR_API int GWEN_Time_GetBrokenDownDate(const GWEN_TIME *t, int *days, int *month, int *year)
GWEN_Time_Milliseconds
GWENHYWFAR_API double GWEN_Time_Milliseconds(const GWEN_TIME *t)
GWEN_Time_fromSeconds
GWENHYWFAR_API GWEN_TIME * GWEN_Time_fromSeconds(uint32_t s)
GWEN_Time_AddSeconds
GWENHYWFAR_API int GWEN_Time_AddSeconds(GWEN_TIME *ti, uint32_t secs)
GWEN_Time_GetBrokenDownTime
GWENHYWFAR_API int GWEN_Time_GetBrokenDownTime(const GWEN_TIME *t, int *hours, int *mins, int *secs)
types.h