diff options
author | Nicolas Hillegeer <nicolas@hillegeer.com> | 2014-07-19 14:33:55 +0200 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2014-07-20 18:27:45 -0400 |
commit | 6610b002ef6068c4a7d4bdec3bd87d61fb934e71 (patch) | |
tree | f4f9cc523215edd4ae48d10fee39b8ddd70d041d /src | |
parent | 8d44e36b1af2b8a0953722bb0a96234dabe3a404 (diff) | |
download | rneovim-6610b002ef6068c4a7d4bdec3bd87d61fb934e71.tar.gz rneovim-6610b002ef6068c4a7d4bdec3bd87d61fb934e71.tar.bz2 rneovim-6610b002ef6068c4a7d4bdec3bd87d61fb934e71.zip |
os/time: make os_get_localtime more portable
gettimeofday() doesn't exist on Windows, as reported by @equalsraf. It seems
a call to time() would be sufficient here, as only the seconds since the
UNIX epoch are needed.
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/os/time.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/nvim/os/time.c b/src/nvim/os/time.c index 00ffccfaa8..813cb073cf 100644 --- a/src/nvim/os/time.c +++ b/src/nvim/os/time.c @@ -1,6 +1,6 @@ #include <stdint.h> #include <stdbool.h> -#include <sys/time.h> +#include <time.h> #include <uv.h> @@ -105,10 +105,6 @@ return result; /// argument) or NULL in case of error struct tm *os_get_localtime(struct tm *result) { - struct timeval tv; - if (gettimeofday(&tv, NULL) < 0) { - return NULL; - } - - return os_localtime_r(&tv.tv_sec, result); + time_t rawtime = time(NULL); + return os_localtime_r(&rawtime, result); } |