# gwentime.h

Go to the documentation of this file.

    00001 /***************************************************************************
    00002  $RCSfile: gwentime.h,v $
    00003                              -------------------
    00004     cvs         : $Id: gwentime.h,v 1.13 2005/03/28 19:05:20 aquamaniac Exp $
    00005     begin       : Wed Mar 24 2004
    00006     copyright   : (C) 2004 by Martin Preuss
    00007     email       : martin@libchipcard.de
    00008
    00009  ***************************************************************************
    00010  *                                                                         *
    00011  *   This library is free software; you can redistribute it and/or         *
    00012  *   modify it under the terms of the GNU Lesser General Public            *
    00013  *   License as published by the Free Software Foundation; either          *
    00014  *   version 2.1 of the License, or (at your option) any later version.    *
    00015  *                                                                         *
    00016  *   This library is distributed in the hope that it will be useful,       *
    00017  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
    00018  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
    00019  *   Lesser General Public License for more details.                       *
    00020  *                                                                         *
    00021  *   You should have received a copy of the GNU Lesser General Public      *
    00022  *   License along with this library; if not, write to the Free Software   *
    00023  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston,                 *
    00024  *   MA  02111-1307  USA                                                   *
    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();
    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(GWEN_TYPE_UINT32 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 GWEN_TYPE_UINT32 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
    00132 GWENHYWFAR_API int GWEN_Time_AddSeconds(GWEN_TIME *ti, GWEN_TYPE_UINT32 secs);
    00133
    00138 GWENHYWFAR_API int GWEN_Time_SubSeconds(GWEN_TIME *ti, GWEN_TYPE_UINT32 secs);
    00139
    00140
    00144 GWENHYWFAR_API int GWEN_Time_GetBrokenDownTime(const GWEN_TIME *t,
    00145                                                int *hours,
    00146                                                int *mins,
    00147                                                int *secs);
    00148
    00152 GWENHYWFAR_API int GWEN_Time_GetBrokenDownUtcTime(const GWEN_TIME *t,
    00153                                                   int *hours,
    00154                                                   int *mins,
    00155                                                   int *secs);
    00156
    00160 GWENHYWFAR_API int GWEN_Time_GetBrokenDownDate(const GWEN_TIME *t,
    00161                                                int *days,
    00162                                                int *month,
    00163                                                int *year);
    00164
    00168 GWENHYWFAR_API int GWEN_Time_GetBrokenDownUtcDate(const GWEN_TIME *t,
    00169                                                   int *days,
    00170                                                   int *month,
    00171                                                   int *year);
    00172
    00177 GWENHYWFAR_API struct tm GWEN_Time_toTm(const GWEN_TIME *t);
    00178
    00182 GWENHYWFAR_API time_t GWEN_Time_toTime_t(const GWEN_TIME *t);
    00183
    00184
    00185
    00186 #ifdef __cplusplus
    00187 }
    00188 #endif
    00189
    00190
    00191
    00192 #endif
    00193