Utility class to assist with Network Time Protocol (NTP) conversions. More...
Instance Methods | |
(NSDate *) | - compactNtpToDateTimeWithNtp: |
Converts a compact NTP timestamp (32 bits) to a date. More... | |
(long long) | - compactNtpToTicksWithNtp: |
Converts a compact NTP timestamp (32 bits) to ticks. More... | |
(long long) | - dateTimeToCompactNtpWithDateTime: |
Converts a date to a compact NTP timestamp (32 bits). More... | |
(double) | - dateTimeToNtpSecondsWithDateTime: |
Converts a date to an NTP timestamp (double). More... | |
(long long) | - dateTimeToNtpWithDateTime: |
Converts a date to an NTP timestamp (64 bits). More... | |
(instancetype) | - init |
Initializes a new instance of the FMLiveSwitchNetworkTimeProtocol class with base set to 1900-01-01. More... | |
(instancetype) | - initWithBaseTicks: |
Initializes a new instance of the FMLiveSwitchNetworkTimeProtocol class. More... | |
(NSDate *) | - ntpSecondsToDateTimeWithNtpSeconds: |
Converts an NTP timestamp (double) to a date. More... | |
(long long) | - ntpSecondsToTicksWithNtpSeconds: |
Converts an NTP timestamp (double) to ticks. More... | |
(NSDate *) | - ntpToDateTimeWithNtp: |
Converts an NTP timestamp (64 bits) to a date. More... | |
(long long) | - ntpToTicksWithNtp: |
Converts an NTP timestamp (64 bits) to ticks. More... | |
(long long) | - ticksToCompactNtpWithTicks: |
Converts ticks to a compact NTP timestamp (32 bits). More... | |
(double) | - ticksToNtpSecondsWithTicks: |
Converts ticks to an NTP timestamp (double). More... | |
(long long) | - ticksToNtpWithTicks: |
Converts ticks to an NTP timestamp (64 bits). More... | |
(long long) | - utcNow |
Gets the current UTC time in NTP format. More... | |
Class Methods | |
(FMLiveSwitchNetworkTimeProtocol *) | + absolute |
Gets an instance of FMLiveSwitchNetworkTimeProtocol that uses 1900-01-01 as the reference date, for use cases where the absolute wall-clock time represented is important. More... | |
(FMLiveSwitchNetworkTimeProtocol *) | + networkTimeProtocol |
Initializes a new instance of the FMLiveSwitchNetworkTimeProtocol class with base set to 1900-01-01. More... | |
(FMLiveSwitchNetworkTimeProtocol *) | + networkTimeProtocolWithBaseTicks: |
Initializes a new instance of the FMLiveSwitchNetworkTimeProtocol class. More... | |
(FMLiveSwitchNetworkTimeProtocol *) | + relative |
Gets an instance of FMLiveSwitchNetworkTimeProtocol that uses zero as the reference date, for use cases where the time is relative to other times, and the reference time is not significant. More... | |
Utility class to assist with Network Time Protocol (NTP) conversions.
NTP timestamps are 64-bit values that can span just over 136 years, from 1900-01-01 to 2036-02-08. Compact NTP timestamps are 32-bit values that can span span just over 18 hours. These utility methods guarantee precision to the millisecond.
+ (FMLiveSwitchNetworkTimeProtocol*) absolute |
Gets an instance of FMLiveSwitchNetworkTimeProtocol that uses 1900-01-01 as the reference date, for use cases where the absolute wall-clock time represented is important.
- (NSDate*) compactNtpToDateTimeWithNtp: | (long long) | ntp |
Converts a compact NTP timestamp (32 bits) to a date.
ntp | The NTP timestamp to convert. |
- (long long) compactNtpToTicksWithNtp: | (long long) | ntp |
Converts a compact NTP timestamp (32 bits) to ticks.
ntp | The NTP timestamp to convert. |
- (long long) dateTimeToCompactNtpWithDateTime: | (NSDate *) | dateTime |
Converts a date to a compact NTP timestamp (32 bits).
dateTime | The date to convert. |
- (double) dateTimeToNtpSecondsWithDateTime: | (NSDate *) | dateTime |
Converts a date to an NTP timestamp (double).
dateTime | The date to convert. |
- (long long) dateTimeToNtpWithDateTime: | (NSDate *) | dateTime |
Converts a date to an NTP timestamp (64 bits).
dateTime | The date to convert. |
- (instancetype) init |
Initializes a new instance of the FMLiveSwitchNetworkTimeProtocol class with base set to 1900-01-01.
- (instancetype) initWithBaseTicks: | (long long) | baseTicks |
Initializes a new instance of the FMLiveSwitchNetworkTimeProtocol class.
baseTicks | The base ticks. |
+ (FMLiveSwitchNetworkTimeProtocol*) networkTimeProtocol |
Initializes a new instance of the FMLiveSwitchNetworkTimeProtocol class with base set to 1900-01-01.
+ (FMLiveSwitchNetworkTimeProtocol*) networkTimeProtocolWithBaseTicks: | (long long) | baseTicks |
Initializes a new instance of the FMLiveSwitchNetworkTimeProtocol class.
baseTicks | The base ticks. |
- (NSDate*) ntpSecondsToDateTimeWithNtpSeconds: | (double) | ntpSeconds |
Converts an NTP timestamp (double) to a date.
ntpSeconds | The NTP timestamp to convert. |
- (long long) ntpSecondsToTicksWithNtpSeconds: | (double) | ntpSeconds |
Converts an NTP timestamp (double) to ticks.
ntpSeconds | The NTP timestamp to convert. |
- (NSDate*) ntpToDateTimeWithNtp: | (long long) | ntp |
Converts an NTP timestamp (64 bits) to a date.
ntp | The NTP timestamp to convert. |
- (long long) ntpToTicksWithNtp: | (long long) | ntp |
Converts an NTP timestamp (64 bits) to ticks.
ntp | The NTP timestamp to convert. |
+ (FMLiveSwitchNetworkTimeProtocol*) relative |
Gets an instance of FMLiveSwitchNetworkTimeProtocol that uses zero as the reference date, for use cases where the time is relative to other times, and the reference time is not significant.
- (long long) ticksToCompactNtpWithTicks: | (long long) | ticks |
Converts ticks to a compact NTP timestamp (32 bits).
ticks | The ticks to convert. |
- (double) ticksToNtpSecondsWithTicks: | (long long) | ticks |
Converts ticks to an NTP timestamp (double).
ticks | The ticks to convert. |
- (long long) ticksToNtpWithTicks: | (long long) | ticks |
Converts ticks to an NTP timestamp (64 bits).
ticks | The ticks to convert. |
- (long long) utcNow |
Gets the current UTC time in NTP format.