hoshi-lang dev
Yet another programming language
Loading...
Searching...
No Matches
time.h File Reference
#include "runtime/memory/memory.h"
#include <cstdint>
#include <ctime>
Include dependency graph for time.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  YoiIntAndIntObject
 

Macros

#define MAX_TIME_STR_LEN   128
 
#define LIBTIME_EXPORT   extern "C"
 
#define LIBTIME_NOFFI
 
#define LIBTIME_FFI
 

Functions

LIBTIME_EXPORT LIBTIME_NOFFI YoiIntAndIntObjectruntime_time_now ()
 Return the current time as a YoiIntAndIntObject.
 
LIBTIME_EXPORT LIBTIME_FFI void runtime_time_sleep (int64_t seconds, int64_t nanoseconds)
 Sleep for a given number of seconds.
 
LIBTIME_EXPORT LIBTIME_FFI char * runtime_time_strftime (const char *format, int64_t timestamp)
 Convert a timestamp to a string according to a given format.
 
LIBTIME_EXPORT LIBTIME_FFI int64_t runtime_time_localtimezone_offset ()
 Get the local timezone offset in seconds.
 
LIBTIME_EXPORT LIBTIME_NOFFI YoiIntAndIntObjectruntime_time_monotonic_now ()
 Get the current monotonic time as a YoiIntAndIntObject.
 
LIBTIME_EXPORT LIBTIME_FFI void runtime_time_finalize (void *memory)
 Finalize the memory created by the time module.
 

Macro Definition Documentation

◆ LIBTIME_EXPORT

#define LIBTIME_EXPORT   extern "C"

Definition at line 34 of file time.h.

◆ LIBTIME_FFI

#define LIBTIME_FFI

Definition at line 36 of file time.h.

◆ LIBTIME_NOFFI

#define LIBTIME_NOFFI

Definition at line 35 of file time.h.

◆ MAX_TIME_STR_LEN

#define MAX_TIME_STR_LEN   128

Definition at line 20 of file time.h.

Function Documentation

◆ runtime_time_finalize()

LIBTIME_EXPORT LIBTIME_FFI void runtime_time_finalize ( void *  memory)

Finalize the memory created by the time module.

Parameters
memoryThe memory to finalize.

Definition at line 208 of file time.cpp.

◆ runtime_time_localtimezone_offset()

LIBTIME_EXPORT LIBTIME_FFI int64_t runtime_time_localtimezone_offset ( )

Get the local timezone offset in seconds.

Returns
int64_t The local timezone offset in seconds.

Definition at line 193 of file time.cpp.

References get_tm_gmtoff().

Here is the call graph for this function:

◆ runtime_time_monotonic_now()

LIBTIME_EXPORT LIBTIME_NOFFI YoiIntAndIntObject * runtime_time_monotonic_now ( )

Get the current monotonic time as a YoiIntAndIntObject.

Returns
YoiIntAndIntObject* The current monotonic time as a YoiIntAndIntObject.
Note
The type-id of the returned object will be audited by the runtime.

Definition at line 200 of file time.cpp.

References YoiIntAndIntObject::create().

Here is the call graph for this function:

◆ runtime_time_now()

Return the current time as a YoiIntAndIntObject.

Returns
YoiIntAndIntObject* The current time as a YoiIntAndIntObject.
Note
The type-id of the returned object will be audited by the runtime.

Definition at line 169 of file time.cpp.

References YoiIntAndIntObject::create().

Here is the call graph for this function:

◆ runtime_time_sleep()

LIBTIME_EXPORT LIBTIME_FFI void runtime_time_sleep ( int64_t  seconds,
int64_t  nanoseconds 
)

Sleep for a given number of seconds.

Parameters
secondsThe number of seconds to sleep.

Definition at line 177 of file time.cpp.

◆ runtime_time_strftime()

LIBTIME_EXPORT LIBTIME_FFI char * runtime_time_strftime ( const char *  format,
int64_t  timestamp 
)

Convert a timestamp to a string according to a given format.

Parameters
formatThe format string.
timestampThe timestamp to convert.
Returns
char* The resulting string.

Definition at line 184 of file time.cpp.

References MAX_TIME_STR_LEN.