summaryrefslogtreecommitdiff
path: root/src/lib/evil
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2019-05-08 14:00:47 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2019-05-08 14:01:02 +0100
commit20b38ad447a1014587ed9ea2e73bf817aa446b31 (patch)
tree22ff45e08b65ca310abeaf3a5c0b411f5cf9f149 /src/lib/evil
parentb141c42e3f932c4b935df2a13ef55d4e7f66a726 (diff)
Revert "Evil: remove localtime_r as mingw-w64 defines it when _POSIX_C_SOURCE is defined"
This reverts commit a4c44e5e744dba15dfe512668127906afd4b6dba. this breaks on osx it seems... :(
Diffstat (limited to 'src/lib/evil')
-rw-r--r--src/lib/evil/evil_macro_wrapper.h14
-rw-r--r--src/lib/evil/evil_time.c10
-rw-r--r--src/lib/evil/evil_time.h23
3 files changed, 44 insertions, 3 deletions
diff --git a/src/lib/evil/evil_macro_wrapper.h b/src/lib/evil/evil_macro_wrapper.h
index cd650e5..19e68d3 100644
--- a/src/lib/evil/evil_macro_wrapper.h
+++ b/src/lib/evil/evil_macro_wrapper.h
@@ -46,6 +46,20 @@
46#define mkdir(dirname, mode) evil_mkdir(dirname, mode) 46#define mkdir(dirname, mode) evil_mkdir(dirname, mode)
47 47
48/* 48/*
49 * evil_time.h
50 */
51
52/**
53 * @def localtime_r(t, r)
54 *
55 * Wrapper around evil_localtime_r().
56 */
57#ifdef localtime_r
58# undef localtime_r
59#endif
60#define localtime_r(t, r) evil_localtime_r(t, r)
61
62/*
49 * evil_unistd.h 63 * evil_unistd.h
50 */ 64 */
51 65
diff --git a/src/lib/evil/evil_time.c b/src/lib/evil/evil_time.c
index 90b6369..76c5a58 100644
--- a/src/lib/evil/evil_time.c
+++ b/src/lib/evil/evil_time.c
@@ -12,6 +12,16 @@
12#include "evil_macro_wrapper.h" 12#include "evil_macro_wrapper.h"
13#include "evil_private.h" 13#include "evil_private.h"
14 14
15struct tm *
16evil_localtime_r(const time_t *timep, struct tm *result)
17{
18 __time64_t t = *timep;
19
20 _localtime64_s(result, &t);
21
22 return result;
23}
24
15/* 25/*
16 * strptime 26 * strptime
17 * based on http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/time/strptime.c?rev=HEAD 27 * based on http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/time/strptime.c?rev=HEAD
diff --git a/src/lib/evil/evil_time.h b/src/lib/evil/evil_time.h
index 00f538c..34607de 100644
--- a/src/lib/evil/evil_time.h
+++ b/src/lib/evil/evil_time.h
@@ -2,9 +2,6 @@
2#define __EVIL_TIME_H__ 2#define __EVIL_TIME_H__
3 3
4 4
5#include <time.h>
6
7
8/** 5/**
9 * @file evil_time.h 6 * @file evil_time.h
10 * @brief The file that provides functions ported from Unix in time.h. 7 * @brief The file that provides functions ported from Unix in time.h.
@@ -18,6 +15,26 @@
18 15
19 16
20/** 17/**
18 * @brief Convert the calendar time to broken-time representation in a
19 * user supplied data.
20 *
21 * @param timep The calender time.
22 * @param result The broken-down time representation.
23 * @return The broken-down time representation.
24 *
25 * This function converts the calendar time @p timep to a broken-time
26 * representation. The result is stored in the buffer @p result
27 * supplied by the user. If @p timep or @p result are @c NULL, or if
28 * an error occurred, this function returns @c NULL and the values in
29 * @p result might be undefined. Otherwise it returns @p result.
30 *
31 * Conformity: Non applicable.
32 *
33 * Supported OS: Windows XP.
34 */
35EAPI struct tm *evil_localtime_r(const time_t *timep, struct tm *result);
36
37/**
21 * @brief Convert a string representation of time to a time tm structure . 38 * @brief Convert a string representation of time to a time tm structure .
22 * 39 *
23 * @param buf The string to convert. 40 * @param buf The string to convert.