diff options
author | Thiago de Arruda <tpadilha84@gmail.com> | 2014-06-02 11:24:02 -0300 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-06-02 11:24:02 -0300 |
commit | cab8cf970c09ea465d30e11eb356e2e5d37dc544 (patch) | |
tree | 5d274c892e4d53f5e976ae8f6f58aba030785e02 /src/nvim/os/time.c | |
parent | 52a9a5b0b0c53a1481d901f39ed0d1e7e86c3853 (diff) | |
parent | 4aecb71b0e819aa84a430dacdab2146229c410a5 (diff) | |
download | rneovim-cab8cf970c09ea465d30e11eb356e2e5d37dc544.tar.gz rneovim-cab8cf970c09ea465d30e11eb356e2e5d37dc544.tar.bz2 rneovim-cab8cf970c09ea465d30e11eb356e2e5d37dc544.zip |
Merge pull request #710 'Automatically generate declarations'
Diffstat (limited to 'src/nvim/os/time.c')
-rw-r--r-- | src/nvim/os/time.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/nvim/os/time.c b/src/nvim/os/time.c index 2a607de36d..977a4f19c4 100644 --- a/src/nvim/os/time.c +++ b/src/nvim/os/time.c @@ -11,19 +11,30 @@ static uv_mutex_t delay_mutex; static uv_cond_t delay_cond; -static void microdelay(uint64_t ms); +#ifdef INCLUDE_GENERATED_DECLARATIONS +# include "os/time.c.generated.h" +#endif +/// Initializes the time module void time_init() { uv_mutex_init(&delay_mutex); uv_cond_init(&delay_cond); } +/// Sleeps for a certain amount of milliseconds +/// +/// @param milliseconds Number of milliseconds to sleep +/// @param ignoreinput If true, allow a SIGINT to interrupt us void os_delay(uint64_t milliseconds, bool ignoreinput) { os_microdelay(milliseconds * 1000, ignoreinput); } +/// Sleeps for a certain amount of microseconds +/// +/// @param microseconds Number of microseconds to sleep +/// @param ignoreinput If true, allow a SIGINT to interrupt us void os_microdelay(uint64_t microseconds, bool ignoreinput) { int old_tmode; @@ -61,6 +72,9 @@ static void microdelay(uint64_t microseconds) uv_mutex_unlock(&delay_mutex); } +/// Portable version of POSIX localtime_r() +/// +/// @return NULL in case of error struct tm *os_localtime_r(const time_t *clock, struct tm *result) { #ifdef UNIX @@ -75,6 +89,11 @@ return result; #endif } +/// Obtains the current UNIX timestamp and adjusts it to local time +/// +/// @param result Pointer to a 'struct tm' where the result should be placed +/// @return A pointer to a 'struct tm' in the current time zone (the 'result' +/// argument) or NULL in case of error struct tm *os_get_localtime(struct tm *result) { struct timeval tv; |