datetime.h (1592B)
1 /* 2 * libdivecomputer 3 * 4 * Copyright (C) 2010 Jef Driesen 5 * 6 * This library is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License as published by the Free Software Foundation; either 9 * version 2.1 of the License, or (at your option) any later version. 10 * 11 * This library is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public 17 * License along with this library; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 19 * MA 02110-1301 USA 20 */ 21 22 #ifndef DC_DATETIME_H 23 #define DC_DATETIME_H 24 25 #include <limits.h> 26 27 #ifdef __cplusplus 28 extern "C" { 29 #endif /* __cplusplus */ 30 31 #define DC_TIMEZONE_NONE INT_MIN 32 33 #if defined (_WIN32) && !defined (__GNUC__) 34 typedef __int64 dc_ticks_t; 35 #else 36 typedef long long int dc_ticks_t; 37 #endif 38 39 typedef struct dc_datetime_t { 40 int year; 41 int month; 42 int day; 43 int hour; 44 int minute; 45 int second; 46 int timezone; 47 } dc_datetime_t; 48 49 dc_ticks_t 50 dc_datetime_now (void); 51 52 dc_datetime_t * 53 dc_datetime_localtime (dc_datetime_t *result, 54 dc_ticks_t ticks); 55 56 dc_datetime_t * 57 dc_datetime_gmtime (dc_datetime_t *result, 58 dc_ticks_t ticks); 59 60 dc_ticks_t 61 dc_datetime_mktime (const dc_datetime_t *dt); 62 63 #ifdef __cplusplus 64 } 65 #endif /* __cplusplus */ 66 #endif /* DC_DATETIME_H */