time.h 4.09 KB
Newer Older
1 2 3 4
/*
 * Time definitions
 *
 * Copyright 2000 Francois Gouget.
5 6 7 8 9 10 11 12 13 14 15 16 17
 *
 * 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
18
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 20 21 22
 */
#ifndef __WINE_TIME_H
#define __WINE_TIME_H

23
#include <corecrt_wtime.h>
24

25
#include <pshpack8.h>
26

27
#ifndef _CLOCK_T_DEFINED
28
typedef __msvcrt_long clock_t;
29
#define _CLOCK_T_DEFINED
30
#endif
31

32 33 34 35
#ifndef CLOCKS_PER_SEC
#define CLOCKS_PER_SEC 1000
#endif

36 37 38 39
#ifdef __cplusplus
extern "C" {
#endif

40
#ifdef __i386__
41 42 43 44
#define _daylight (*__p__daylight())
#define _dstbias (*__p__dstbias())
#define _timezone (*__p__timezone())
#define _tzname (__p__tzname())
45

46 47 48 49
_ACRTIMP int *   __cdecl __p__daylight(void);
_ACRTIMP __msvcrt_long *  __cdecl __p__dstbias(void);
_ACRTIMP __msvcrt_long *  __cdecl __p__timezone(void);
_ACRTIMP char ** __cdecl __p__tzname(void);
50 51
#else
extern int _daylight;
52 53
extern __msvcrt_long _dstbias;
extern __msvcrt_long _timezone;
54 55
extern char *_tzname;
#endif
56

57
#if !defined(_UCRT) && defined(_USE_32BIT_TIME_T)
58 59 60 61 62 63 64 65
#define _ctime32     ctime
#define _difftime32  difftime
#define _gmtime32    gmtime
#define _localtime32 localtime
#define _mktime32    mktime
#define _time32      time
#endif

66 67 68 69 70 71 72
_ACRTIMP unsigned    __cdecl _getsystime(struct tm*);
_ACRTIMP unsigned    __cdecl _setsystime(struct tm*,unsigned);
_ACRTIMP char*       __cdecl _strdate(char*);
_ACRTIMP errno_t     __cdecl _strdate_s(char*,size_t);
_ACRTIMP char*       __cdecl _strtime(char*);
_ACRTIMP errno_t     __cdecl _strtime_s(char*,size_t);
_ACRTIMP void        __cdecl _tzset(void);
73

74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
_ACRTIMP char*       __cdecl asctime(const struct tm*);
_ACRTIMP clock_t     __cdecl clock(void);
_ACRTIMP char*       __cdecl _ctime32(const __time32_t*);
_ACRTIMP char*       __cdecl _ctime64(const __time64_t*);
_ACRTIMP double      __cdecl _difftime32(__time32_t,__time32_t);
_ACRTIMP double      __cdecl _difftime64(__time64_t,__time64_t);
_ACRTIMP struct tm*  __cdecl _gmtime32(const __time32_t*);
_ACRTIMP struct tm*  __cdecl _gmtime64(const __time64_t*);
_ACRTIMP struct tm*  __cdecl _localtime32(const __time32_t*);
_ACRTIMP errno_t     __cdecl _localtime32_s(struct tm*, const __time32_t*);
_ACRTIMP struct tm*  __cdecl _localtime64(const __time64_t*);
_ACRTIMP errno_t     __cdecl _localtime64_s(struct tm*, const __time64_t*);
_ACRTIMP __time32_t  __cdecl _mktime32(struct tm*);
_ACRTIMP __time64_t  __cdecl _mktime64(struct tm*);
_ACRTIMP size_t      __cdecl strftime(char*,size_t,const char*,const struct tm*);
_ACRTIMP __time32_t  __cdecl _time32(__time32_t*);
_ACRTIMP __time64_t  __cdecl _time64(__time64_t*);
91 92 93 94 95 96 97 98

#ifndef _USE_32BIT_TIME_T
static inline char* ctime(const time_t *t) { return _ctime64(t); }
static inline double difftime(time_t t1, time_t t2) { return _difftime64(t1, t2); }
static inline struct tm* gmtime(const time_t *t) { return _gmtime64(t); }
static inline struct tm* localtime(const time_t *t) { return _localtime64(t); }
static inline time_t mktime(struct tm *tm) { return _mktime64(tm); }
static inline time_t time(time_t *t) { return _time64(t); }
99 100 101 102 103 104 105
#elif defined(_UCRT)
static inline char* ctime(const time_t *t) { return _ctime32(t); }
static inline double difftime(time_t t1, time_t t2) { return _difftime32(t1, t2); }
static inline struct tm* gmtime(const time_t *t) { return _gmtime32(t); }
static inline struct tm* localtime(const time_t *t) { return _localtime32(t); }
static inline time_t mktime(struct tm *tm) { return _mktime32(tm); }
static inline time_t time(time_t *t) { return _time32(t); }
106
#endif
107

108 109 110 111
#ifdef __cplusplus
}
#endif

112 113
#include <poppack.h>

114
#endif /* __WINE_TIME_H */