libnx  v4.2.0
Data Structures | Enumerations | Functions
time.h File Reference

Time services IPC wrapper. More...

#include "../types.h"
#include "../sf/service.h"

Go to the source code of this file.

Data Structures

struct  TimeCalendarTime
 
struct  TimeCalendarAdditionalInfo
 
struct  TimeZoneRule
 
struct  TimeLocationName
 
struct  TimeSteadyClockTimePoint
 
struct  TimeStandardSteadyClockTimePointType
 
struct  TimeSystemClockContext
 

Enumerations

enum  TimeServiceType {
  TimeServiceType_User = 0,
  TimeServiceType_Menu = 1,
  TimeServiceType_System = 2,
  TimeServiceType_Repair = 3,
  TimeServiceType_SystemUser = 4
}
 Values for __nx_time_service_type. More...
 
enum  TimeType {
  TimeType_UserSystemClock,
  TimeType_NetworkSystemClock,
  TimeType_LocalSystemClock,
  TimeType_Default = TimeType_UserSystemClock
}
 Time clock type.
 

Functions

Result timeInitialize (void)
 Initialize time. Used automatically during app startup.
 
void timeExit (void)
 Exit time. Used automatically during app startup.
 
ServicetimeGetServiceSession (void)
 Gets the Service object for the actual time service session.
 
ServicetimeGetServiceSession_SystemClock (TimeType type)
 Gets the Service object for ISystemClock with the specified TimeType. This will return NULL when the type is invalid.
 
ServicetimeGetServiceSession_SteadyClock (void)
 Gets the Service object for ISteadyClock.
 
ServicetimeGetServiceSession_TimeZoneService (void)
 Gets the Service object for ITimeZoneService.
 
void * timeGetSharedmemAddr (void)
 [6.0.0+] Gets the address of the SharedMemory.
 
Result timeGetStandardSteadyClockTimePoint (TimeSteadyClockTimePoint *out)
 Gets the timepoint for the standard steady clock. More...
 
Result timeGetStandardSteadyClockInternalOffset (s64 *out)
 [3.0.0+] Gets the internal offset for the standard steady clock. More...
 
Result timeGetCurrentTime (TimeType type, u64 *timestamp)
 Gets the time for the specified clock. More...
 
Result timeSetCurrentTime (TimeType type, u64 timestamp)
 Sets the time for the specified clock. More...
 
Result timeGetDeviceLocationName (TimeLocationName *name)
 
Result timeSetDeviceLocationName (const TimeLocationName *name)
 
Result timeGetTotalLocationNameCount (s32 *total_location_name_count)
 
Result timeLoadLocationNameList (s32 index, TimeLocationName *location_name_array, s32 location_name_max, s32 *location_name_count)
 
Result timeLoadTimeZoneRule (const TimeLocationName *name, TimeZoneRule *rule)
 
Result timeToCalendarTime (const TimeZoneRule *rule, u64 timestamp, TimeCalendarTime *caltime, TimeCalendarAdditionalInfo *info)
 
Result timeToCalendarTimeWithMyRule (u64 timestamp, TimeCalendarTime *caltime, TimeCalendarAdditionalInfo *info)
 
Result timeToPosixTime (const TimeZoneRule *rule, const TimeCalendarTime *caltime, u64 *timestamp_list, s32 timestamp_list_count, s32 *timestamp_count)
 
Result timeToPosixTimeWithMyRule (const TimeCalendarTime *caltime, u64 *timestamp_list, s32 timestamp_list_count, s32 *timestamp_count)
 

Detailed Description

Time services IPC wrapper.

Author
yellows8

Enumeration Type Documentation

◆ TimeServiceType

Values for __nx_time_service_type.

Enumerator
TimeServiceType_User 

Default. Initializes time:u.

TimeServiceType_Menu 

Initializes time:a.

TimeServiceType_System 

Initializes time:s.

TimeServiceType_Repair 

Initializes time:r. Only available with [9.0.0+].

TimeServiceType_SystemUser 

Initializes time:su. Only available with [9.0.0+].

Function Documentation

◆ timeGetCurrentTime()

Result timeGetCurrentTime ( TimeType  type,
u64 timestamp 
)

Gets the time for the specified clock.

Parameters
[in]typeClock to use.
[out]timestampPOSIX UTC timestamp.
Returns
Result code.

◆ timeGetStandardSteadyClockInternalOffset()

Result timeGetStandardSteadyClockInternalOffset ( s64 out)

[3.0.0+] Gets the internal offset for the standard steady clock.

Parameters
[out]outOutput internal offset.
Returns
Result code.

◆ timeGetStandardSteadyClockTimePoint()

Result timeGetStandardSteadyClockTimePoint ( TimeSteadyClockTimePoint out)

Gets the timepoint for the standard steady clock.

Parameters
[out]outOutput timepoint (see TimeSteadyClockTimePoint)
Remarks
The standard steady clock counts time since the RTC was configured (usually this happens during manufacturing).
Returns
Result code.

◆ timeSetCurrentTime()

Result timeSetCurrentTime ( TimeType  type,
u64  timestamp 
)

Sets the time for the specified clock.

Parameters
[in]typeClock to use.
[in]timestampPOSIX UTC timestamp.
Returns
Result code.