KasperskyOS Community Edition 1.1
[Topic libkos_time]

KnGetMSecSinceStart()

This function is declared in the coresrv/time/time_api.h file.

rtl_size_t KnGetMSecSinceStart(void);

Returns the number of milliseconds that have elapsed since the start of the system.

Page top
[Topic kn_get_msec_since_start]

KnGetRtcTime()

This function is declared in the coresrv/time/time_api.h file.

Retcode KnGetRtcTime(RtlRtcTime *rt);

This function writes the POSIX system time (in RTC format) to the rt parameter.

If successful, returns rcOk, or returns rcFail if an error occurs.

The RTC time format is defined by the RtlRtcTime structure (declared in the rtl/rtc.h file.):

typedef struct {

rtl_uint32_t msec; /**< milliseconds */

rtl_uint32_t sec; /**< second (0..59) */

rtl_uint32_t min; /**< minute (0..59) */

rtl_uint32_t hour; /**< hour (0..23) */

rtl_uint32_t mday; /**< day (1..31) */

rtl_uint32_t month; /**< month (0..11) */

rtl_int32_t year; /**< year - 1900 */

rtl_uint32_t wday; /**< week day (0..6) */

} RtlRtcTime;

Page top
[Topic kn_get_rtc_time]

KnGetSystemTime()

This function is declared in the coresrv/time/time_api.h file.

Retcode KnGetSystemTime(RtlTimeSpec *time);

This function lets you get the system time.

Output parameter time contains the POSIX system time in RtlTimeSpec format.

Page top
[Topic kn_get_system_time]

KnSetSystemTime()

This function is declared in the coresrv/time/time_api.h file.

Retcode KnSetSystemTime(RtlTimeSpec *time);

This function lets you set the system time.

The time parameter must contain the POSIX time in RtlTimeSpec format.

It is not recommended to call the KnSetSystemTime() function in the interrupt handler thread.

Page top
[Topic kn_set_system_time]

KnGetSystemTimeRes()

This function is declared in the coresrv/time/time_api.h file.

Retcode KnGetSystemTimeRes(RtlTimeSpec *res);

This function lets you get the resolution of the system time source.

Output parameter res contains the resolution in RtlTimeSpec format.

Page top
[Topic kn_get_system_time_res]

KnGetUpTime()

This function is declared in the coresrv/time/time_api.h file.

Retcode KnGetUpTime(RtlTimeSpec *time);

This function lets you get the time that has elapsed since the start of the system.

Output parameter time contains the time in RtlTimeSpec format.

Page top
[Topic kn_get_up_time]

KnGetUpTimeRes()

This function is declared in the coresrv/time/time_api.h file.

Retcode KnGetUpTimeRes(RtlTimeSpec *res);

This function receives the resolution of the source of time whose value can be obtained via KnGetUpTime().

Output parameter res contains the resolution in RtlTimeSpec format.

Page top
[Topic kn_get_up_time_res]

RtlTimeSpec

The timespec time format is defined by the RtlTimeSpec structure (declared in the rtl/rtc.h file).

typedef struct {

rtl_time_t sec; /**< integer number of seconds that have elapsed since the start of the Unix epoch

* or another defined point in time */

rtl_nsecs_t nsec; /**< adjustment in nanoseconds (number of nanoseconds

* that have elapsed since the point in time defined by the number of seconds*/

} RtlTimeSpec;

Page top
[Topic rtl_time_spec]