2 * SPDX-License-Identifier: MIT
4 * Copyright (C) 2013 JP Ikaheimonen <jp_ikaheimonen@mentor.com>
5 * Copyright (C) 2016 Michael Jeanson <mjeanson@efficios.com>
8 #ifndef _BABELTRACE_INCLUDE_COMPAT_TIME_H
9 #define _BABELTRACE_INCLUDE_COMPAT_TIME_H
19 * The Windows version of the time functions use one common tm structure per
20 * thread which makes them thread-safe. Implement the POSIX _r variants by
21 * copying this to a user supplied struct.
25 struct tm
*bt_gmtime_r(const time_t *timep
, struct tm
*result
)
33 local_res
= gmtime(timep
);
39 memcpy(result
, local_res
, sizeof(struct tm
));
46 struct tm
*bt_localtime_r(const time_t *timep
, struct tm
*result
)
54 local_res
= localtime(timep
);
60 memcpy(result
, local_res
, sizeof(struct tm
));
66 #else /* __MINGW32__ */
69 struct tm
*bt_gmtime_r(const time_t *timep
, struct tm
*result
)
71 return gmtime_r(timep
, result
);
75 struct tm
*bt_localtime_r(const time_t *timep
, struct tm
*result
)
77 return localtime_r(timep
, result
);
80 #endif /* __MINGW32__ */
81 #endif /* _BABELTRACE_INCLUDE_COMPAT_TIME_H */
This page took 0.031593 seconds and 4 git commands to generate.