Functions
time.c File Reference
#include <assert.h>
#include <stdint.h>
#include <stdbool.h>
#include <time.h>
#include <limits.h>
#include <uv.h>
#include "nvim/os/input.h"
#include "nvim/event/loop.h"
#include "nvim/vim.h"
#include "nvim/main.h"

Functions

void time_init (void)
 Initializes the time module. More...
 
uint64_t os_hrtime (void)
 
void os_delay (uint64_t ms, bool ignoreinput)
 
void os_microdelay (uint64_t us, bool ignoreinput)
 
struct tm * os_localtime_r (const time_t *restrict clock, struct tm *restrict result) FUNC_ATTR_NONNULL_ALL
 
struct tm * os_localtime (struct tm *result) FUNC_ATTR_NONNULL_ALL
 
Timestamp os_time (void)
 

Function Documentation

void os_delay ( uint64_t  ms,
bool  ignoreinput 
)

Sleeps for ms milliseconds.

Parameters
msNumber of milliseconds to sleep
ignoreinputIf true, only SIGINT (CTRL-C) can interrupt.
uint64_t os_hrtime ( void  )

Obtain a high-resolution timer value

Returns
a timer value, not related to the time of day and not subject to clock drift. The value is expressed in nanoseconds.
struct tm* os_localtime ( struct tm *  result)

Gets the current Unix timestamp and adjusts it to local time.

Parameters
resultPointer to a 'struct tm' where the result should be placed
Returns
A pointer to a 'struct tm' in the current time zone (the 'result' argument) or NULL in case of error
struct tm* os_localtime_r ( const time_t *restrict  clock,
struct tm *restrict  result 
)

Portable version of POSIX localtime_r()

Returns
NULL in case of error
void os_microdelay ( uint64_t  us,
bool  ignoreinput 
)

Sleeps for us microseconds.

Parameters
usNumber of microseconds to sleep.
ignoreinputIf true, ignore all input (including SIGINT/CTRL-C). If false, waiting is aborted on any input.
Timestamp os_time ( void  )

Obtains the current Unix timestamp.

Returns
Seconds since epoch.
void time_init ( void  )

Initializes the time module.