OSAPI  0.29
Open System API
CLOCK

The clock module. More...

Collaboration diagram for CLOCK:

Functions

t_status clock_module_supported (void)
 Declares if the module is supported on the current implementation. More...
 
t_status clock_chrono_start (t_chrono *ctime)
 Get the current machine/real time in seconds from the epoch. More...
 
t_status clock_chrono_stop (t_chrono *ctime)
 Compute a delta between first measurement (in the start method) and now. More...
 
t_status clock_instance_createTimezone (t_time *value, const char *timezone, t_clock *clk)
 Create a new clock instance based on a given timezone and time value. More...
 
t_status clock_instance_createOffset (t_time *value, t_time_offset *offset, t_clock *clk)
 Create a new clock instance based on a given time offset from the standard time. More...
 
t_status clock_instance_getLocalTime (t_clock *clk, t_time *localTime)
 Get the current local time from a clock. More...
 
t_status clock_instance_getTime (t_clock *clk, t_time *stdTime)
 Get the current standard time from a clock. More...
 
t_status clock_instance_update (t_clock *clk)
 Refresh the clock time. More...
 
t_status clock_time_make (int64_t seconds, uint64_t fraction, t_time_precision precision, t_time *tm)
 Set the time structure with the supplied data. More...
 
t_status clock_time_get (t_time *curtime)
 Get the current machine/real time in seconds from the system epoch. More...
 
t_status clock_time_getPrecise (t_time *curtime)
 Get the current time in the highest available resolution since the machine/OS epoch. More...
 
t_status clock_time_getResolution (t_time *tm, int *resolution)
 Extract the resolution from a time type. More...
 
t_status clock_time_print (t_time *ctime, const char *tmString)
 Print the current time in seconds from the epoch in human readable format. More...
 
t_status clock_time_diff (t_time t1, t_time t2, t_time *diff)
 Return the difference between two times, in seconds. More...
 
t_status clock_time_copy (const t_time *source, t_time *target)
 Perform a copy between two time types. More...
 
t_status clock_time_equal (const t_time *t1, const t_time *t2, bool *result)
 Perform a comparison between two time types. More...
 
t_status clock_offset_make (int64_t seconds, uint64_t fraction, t_time_offset *offset)
 Generate a time offset from components. More...
 
t_status clock_offset_copy (const t_time_offset *source, t_time_offset *target)
 Perform a copy between two time offset types. More...
 
t_status clock_offset_apply (t_time *base, t_time_offset *offset, t_time *result)
 Incorporate a time offset into a new time. More...
 
t_status clock_vtime_get (t_time *vtime)
 Get the current virtual (monotonic) time in seconds. More...
 
t_status clock_vtime_getPrecise (t_time *vtime)
 Get the current monotonic time in the highest available resolution. More...
 
t_status clock_timezone_set (const t_char *tz)
 Set the current process timezone. More...
 
t_status clock_timezone_get (t_size size, t_char *tz)
 Get the current process timezone. More...
 

Detailed Description

The clock module.


Function Documentation

◆ clock_chrono_start()

t_status clock_chrono_start ( t_chrono ctime)

Get the current machine/real time in seconds from the epoch.

Parameters
[out]ctime- Initial time
Returns
Operation status

◆ clock_chrono_stop()

t_status clock_chrono_stop ( t_chrono ctime)

Compute a delta between first measurement (in the start method) and now.

Parameters
[in,out]ctime- Current time delta from initial time
Returns
Operation status

◆ clock_instance_createOffset()

t_status clock_instance_createOffset ( t_time value,
t_time_offset offset,
t_clock clk 
)

Create a new clock instance based on a given time offset from the standard time.

Parameters
[in]value- The time value (standard format)
[in]offset- The offset value
[out]clk- The new clock instance
Returns
Operation status
Here is the call graph for this function:

◆ clock_instance_createTimezone()

t_status clock_instance_createTimezone ( t_time value,
const char *  timezone,
t_clock clk 
)

Create a new clock instance based on a given timezone and time value.

Parameters
[in]value- The time value (standard format)
[in]timezone- The timezone information (e.g. CDT)
[out]clk- The new clock instance
Returns
Operation status

◆ clock_instance_getLocalTime()

t_status clock_instance_getLocalTime ( t_clock clk,
t_time localTime 
)

Get the current local time from a clock.

Parameters
[in]clk- The current clock
[out]localTime- The extracted local time
Returns
Operation status
Here is the call graph for this function:

◆ clock_instance_getTime()

t_status clock_instance_getTime ( t_clock clk,
t_time stdTime 
)

Get the current standard time from a clock.

Parameters
[in]clk- The current clock
[out]stdTime- The extracted local time
Returns
Operation status

◆ clock_instance_update()

t_status clock_instance_update ( t_clock clk)

Refresh the clock time.

Parameters
[out]clk- The updated clock
Returns
Operation status
Here is the call graph for this function:

◆ clock_module_supported()

t_status clock_module_supported ( void  )

Declares if the module is supported on the current implementation.

Returns
SUCCESS or FAILURE

◆ clock_offset_apply()

t_status clock_offset_apply ( t_time base,
t_time_offset offset,
t_time result 
)

Incorporate a time offset into a new time.

Parameters
[in]base- The source time
[in]offset- The time offset
[out]result- The result time after applying an offset to a base time
Returns
Precision time enum
Here is the caller graph for this function:

◆ clock_offset_copy()

t_status clock_offset_copy ( const t_time_offset source,
t_time_offset target 
)

Perform a copy between two time offset types.

Parameters
[in]source- Copy from
[out]target- Copy to
Returns
Operation status
Here is the caller graph for this function:

◆ clock_offset_make()

t_status clock_offset_make ( int64_t  seconds,
uint64_t  fraction,
t_time_offset offset 
)

Generate a time offset from components.

Parameters
[in]seconds- Time in seconds from a certain origin
[in]fraction- The fraction of a second
[out]offset- The result time offset type
Returns
Precision time enum

◆ clock_time_copy()

t_status clock_time_copy ( const t_time source,
t_time target 
)

Perform a copy between two time types.

Parameters
[in]source- Copy from
[out]target- Copy to
Returns
Operation status

◆ clock_time_diff()

t_status clock_time_diff ( t_time  t1,
t_time  t2,
t_time diff 
)

Return the difference between two times, in seconds.

Parameters
[in]t1- First time
[in]t2- Second time
[out]diff- Time difference
Returns
Operation status

◆ clock_time_equal()

t_status clock_time_equal ( const t_time t1,
const t_time t2,
bool *  result 
)

Perform a comparison between two time types.

Parameters
[in]t1- The first time to compare
[in]t2- Second time to compare
[out]result- True if times are the same. False otherwise
Returns
Operation status

◆ clock_time_get()

t_status clock_time_get ( t_time curtime)

Get the current machine/real time in seconds from the system epoch.

Parameters
[out]curtime- Current time
Returns
Operation status
Here is the caller graph for this function:

◆ clock_time_getPrecise()

t_status clock_time_getPrecise ( t_time curtime)

Get the current time in the highest available resolution since the machine/OS epoch.

Parameters
[out]curtime- Current highest precision time
Returns
Operation status

◆ clock_time_getResolution()

t_status clock_time_getResolution ( t_time tm,
int *  resolution 
)

Extract the resolution from a time type.

Parameters
[in]tm- Time information
[out]resolution- Time precision
Returns
Operation status

◆ clock_time_make()

t_status clock_time_make ( int64_t  seconds,
uint64_t  fraction,
t_time_precision  precision,
t_time tm 
)

Set the time structure with the supplied data.

Parameters
[in]seconds- The number of seconds since the machine/OS epoch
[in]fraction- The fraction of a second
[in]precision- The precision of this time (seconds, milli, nano, etc.)
[out]tm- The new time representation
Returns
Operation status

◆ clock_time_print()

t_status clock_time_print ( t_time ctime,
const char *  tmString 
)

Print the current time in seconds from the epoch in human readable format.

Parameters
[in]ctime- The current time
[out]tmString- Formated time string
Returns
Operation status

◆ clock_timezone_get()

t_status clock_timezone_get ( t_size  size,
t_char tz 
)

Get the current process timezone.

Parameters
[in]size- The size of the "tz" string
[out]tz- The buffer where to copy the time zone information
Returns
Operation status

◆ clock_timezone_set()

t_status clock_timezone_set ( const t_char tz)

Set the current process timezone.

Parameters
[in]tz- New time zone
Returns
Operation status

◆ clock_vtime_get()

t_status clock_vtime_get ( t_time vtime)

Get the current virtual (monotonic) time in seconds.

Parameters
[out]vtime- Current virtual time
Returns
Operation status

◆ clock_vtime_getPrecise()

t_status clock_vtime_getPrecise ( t_time vtime)

Get the current monotonic time in the highest available resolution.

Parameters
[out]vtime- Current highest precision time
Returns
Operation status