aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/memory.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2016-09-13 17:23:35 +0200
committerGitHub <noreply@github.com>2016-09-13 17:23:35 +0200
commit172d099c32c4312022929752b1fe2a8f847708ee (patch)
treebc3ec6e160fbe1cb86f996445c8b81e172c6403d /src/nvim/memory.c
parent7eb4d2f79dcc712dae1513516b9db5f574d51437 (diff)
parentca93b4a299feaf2ab9344c026b89e5fba360372e (diff)
downloadrneovim-172d099c32c4312022929752b1fe2a8f847708ee.tar.gz
rneovim-172d099c32c4312022929752b1fe2a8f847708ee.tar.bz2
rneovim-172d099c32c4312022929752b1fe2a8f847708ee.zip
Merge #5329 from justinmk/remove-misc2
Eliminate misc2.c
Diffstat (limited to 'src/nvim/memory.c')
-rw-r--r--src/nvim/memory.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/nvim/memory.c b/src/nvim/memory.c
index 8db47b79c1..3e041be4d3 100644
--- a/src/nvim/memory.c
+++ b/src/nvim/memory.c
@@ -440,6 +440,16 @@ void do_outofmem_msg(size_t size)
}
}
+/// Writes time_t to "buf[8]".
+void time_to_bytes(time_t time_, uint8_t buf[8])
+{
+ // time_t can be up to 8 bytes in size, more than uintmax_t in 32 bits
+ // systems, thus we can't use put_bytes() here.
+ for (size_t i = 7, bufi = 0; bufi < 8; i--, bufi++) {
+ buf[bufi] = (uint8_t)((uint64_t)time_ >> (i * 8));
+ }
+}
+
#if defined(EXITFREE)
#include "nvim/file_search.h"