#include <assert.h>
#include <limits.h>
#include <uv.h>
#include "nvim/event/loop.h"
#include "nvim/main.h"
#include "nvim/os/input.h"
#include "nvim/os/os.h"
#include "nvim/os/time.h"
Functions | |
void | time_init (void) |
Initializes the time module. More... | |
uint64_t | os_hrtime (void) |
uint64_t | os_now (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 |
char * | os_ctime_r (const time_t *restrict clock, char *restrict result, size_t result_len) FUNC_ATTR_NONNULL_ALL FUNC_ATTR_NONNULL_RET |
char * | os_ctime (char *result, size_t result_len) FUNC_ATTR_NONNULL_ALL FUNC_ATTR_NONNULL_RET |
char * | os_strptime (const char *str, const char *format, struct tm *tm) FUNC_ATTR_NONNULL_ALL |
Timestamp | os_time (void) |
char* os_ctime | ( | char * | result, |
size_t | result_len | ||
) |
Gets the current Unix timestamp and adjusts it to local time.
result[out] | Pointer to a 'char' where the result should be placed |
result_len | length of result buffer |
char* os_ctime_r | ( | const time_t *restrict | clock, |
char *restrict | result, | ||
size_t | result_len | ||
) |
Portable version of POSIX ctime_r()
clock[in] | |
result[out] | Pointer to a 'char' where the result should be placed |
result_len | length of result buffer |
Sleeps for ms
milliseconds.
ms | Number of milliseconds to sleep |
ignoreinput | If true, only SIGINT (CTRL-C) can interrupt. |
uint64_t os_hrtime | ( | void | ) |
Gets a high-resolution (nanosecond), monotonically-increasing time relative to an arbitrary time in the past.
Not related to the time of day and therefore not subject to clock drift.
Gets the current Unix timestamp and adjusts it to local time.
result | Pointer to a 'struct tm' where the result should be placed |
Portable version of POSIX localtime_r()
Sleeps for us
microseconds.
us | Number of microseconds to sleep. |
ignoreinput | If true, ignore all input (including SIGINT/CTRL-C). If false, waiting is aborted on any input. |
uint64_t os_now | ( | void | ) |
Gets a millisecond-resolution, monotonically-increasing time relative to an arbitrary time in the past.
Not related to the time of day and therefore not subject to clock drift. The value is cached by the loop, it will not change until the next loop-tick (unless uv_update_time is called).
char* os_strptime | ( | const char * | str, |
const char * | format, | ||
struct tm * | tm | ||
) |
Portable version of POSIX strptime()
str[in] | string to convert |
format[in] | format to parse "str" |
tm[out] | time representation of "str" |