| 1 | /* -*- Mode: C; c-file-style: "stroustrup" -*- */ |
| 2 | |
| 3 | #if !defined( _utct_h ) |
| 4 | #define _utct_h |
| 5 | |
| 6 | #include <time.h> |
| 7 | |
| 8 | #if defined( __cplusplus ) |
| 9 | extern "C" { |
| 10 | #endif |
| 11 | |
| 12 | #if !defined(HCEXPORT) |
| 13 | #if !defined(WIN32) || defined(MONOLITHIC) |
| 14 | #define HCEXPORT |
| 15 | #elif defined(BUILD_DLL) |
| 16 | #define HCEXPORT __declspec(dllexport) |
| 17 | #else /* USE_DLL */ |
| 18 | #define HCEXPORT extern __declspec(dllimport) |
| 19 | #endif |
| 20 | #endif |
| 21 | |
| 22 | const char* strtime( time_t* timep, int utc ); /* ctime like with utc arg */ |
| 23 | time_t mk_utctime( struct tm* tms ); /* mktime like with utc struct tm */ |
| 24 | |
| 25 | /* functions to parse and create UTCTime string which is: |
| 26 | * YYMMDDhhmm[ss]Z |
| 27 | */ |
| 28 | |
| 29 | /* when creating utc string, if requested len is odd Z is appended, |
| 30 | * if even Z is omitted |
| 31 | * |
| 32 | * when parsing Z or missing Z is tolerated |
| 33 | * |
| 34 | * parsing has an extension to parse like: |
| 35 | * |
| 36 | * YYMMDD[hh[mm[ss]]][Z] |
| 37 | */ |
| 38 | |
| 39 | #define MAX_UTC 13 |
| 40 | |
| 41 | HCEXPORT |
| 42 | time_t hashcash_from_utctimestr( const char utct[MAX_UTC+1], int utc ); |
| 43 | |
| 44 | HCEXPORT |
| 45 | int hashcash_to_utctimestr( char utct[MAX_UTC+1], int len, time_t t ); |
| 46 | |
| 47 | #if defined( __cplusplus ) |
| 48 | } |
| 49 | #endif |
| 50 | |
| 51 | #endif |