aboutsummaryrefslogtreecommitdiff
path: root/src/undo.c
diff options
context:
space:
mode:
authorFelipe Oliveira Carvalho <felipekde@gmail.com>2014-05-01 20:24:29 -0300
committerFelipe Oliveira Carvalho <felipekde@gmail.com>2014-05-06 09:22:39 -0300
commit151382d533c2bd77e26e1dfc254e186f7496e226 (patch)
treec3841dddf47c5d75cdc1a11fe5e726c2f1c6bbf2 /src/undo.c
parentee62510d4e623e5fb4a0cc7d5b450ce18c24e25f (diff)
downloadrneovim-151382d533c2bd77e26e1dfc254e186f7496e226.tar.gz
rneovim-151382d533c2bd77e26e1dfc254e186f7496e226.tar.bz2
rneovim-151382d533c2bd77e26e1dfc254e186f7496e226.zip
Introduce os_localtime_r() and os_get_local_time()
Replace localtime() with os_localtime_r() in `eval.c` and `undo.c`.
Diffstat (limited to 'src/undo.c')
-rw-r--r--src/undo.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/undo.c b/src/undo.c
index 243d865513..5e00d58d77 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -103,6 +103,7 @@
#include "screen.h"
#include "sha256.h"
#include "os/os.h"
+#include "os/time.h"
static long get_undolevel(void);
static void u_unch_branch(u_header_T *uhp);
@@ -2455,16 +2456,16 @@ void ex_undolist(exarg_T *eap)
*/
static void u_add_time(char_u *buf, size_t buflen, time_t tt)
{
- struct tm *curtime;
+ struct tm curtime;
if (time(NULL) - tt >= 100) {
- curtime = localtime(&tt);
+ os_localtime_r(&tt, &curtime);
if (time(NULL) - tt < (60L * 60L * 12L))
/* within 12 hours */
- (void)strftime((char *)buf, buflen, "%H:%M:%S", curtime);
+ (void)strftime((char *)buf, buflen, "%H:%M:%S", &curtime);
else
/* longer ago */
- (void)strftime((char *)buf, buflen, "%Y/%m/%d %H:%M:%S", curtime);
+ (void)strftime((char *)buf, buflen, "%Y/%m/%d %H:%M:%S", &curtime);
} else
vim_snprintf((char *)buf, buflen, _("%" PRId64 " seconds ago"),
(int64_t)(time(NULL) - tt));