SKSensorTimestamp
Objective-C
@interface SKSensorTimestamp : NSObject <NSCopying>
Swift
class SKSensorTimestamp : NSObject, NSCopying
SKSensorTimestamp object represent a single point in time.
-
Unavailable
Undocumented
Declaration
Objective-C
- (instancetype)init NS_UNAVAILABLE; -
Creates and returns a new SKSensorTimestamp from an NSDate object. If the sensor does not provide an NSDate object, [NSDate date] can be used.
Declaration
Objective-C
+ (nonnull instancetype)sensorTimestampFromDate:(nonnull NSDate *)date;Swift
convenience init(from date: Date)Parameters
dateThe absolute date that this SKSensorTimestamp object should be initialized with.
Return Value
A new SKSensorTimestamp object initialized with the (NSDate *)date parameter.
-
Creates and returns a new SKSensorTimestamp from a NSTimeInterval object. The time interval should be relative to the last time the device was boot. If the sensor does not provide this value, [NSProcessInfo processInfo].systemUptime can be used.
Declaration
Objective-C
+ (nonnull instancetype)sensorTimestampFromTimeInterval: (NSTimeInterval)timeInterval;Swift
convenience init(fromTimeInterval timeInterval: TimeInterval)Parameters
timeIntervalThe number of seconds since the last time the device was boot.
Return Value
A new SKSensorTimestamp object initialized relative to the timeInterval parameter.
-
Returns an NSDate object of the sensor timestamp.
Declaration
Objective-C
@property (nonatomic, copy, readonly) NSDate *_Nonnull timestamp;Swift
var timestamp: Date { get } -
Returns the interval between the timestamp and the last time the device was boot.
Declaration
Objective-C
@property (nonatomic, readonly) NSTimeInterval timeIntervalSinceLastBoot;Swift
var timeIntervalSinceLastBoot: TimeInterval { get } -
Returns a dictionary that encapsulates the timestamp as a string, the interval since 1970, and the interval since the device was boot.
Declaration
Objective-C
@property (nonatomic, copy, readonly) NSDictionary *_Nonnull timestampDictionary;Swift
var timestampDictionary: [AnyHashable : Any] { get } -
Returns a string representation of the timestamp. The format of the string is “yyyy-MM-dd HH:mm:ss.SSS ZZZ”.
Declaration
Objective-C
@property (nonatomic, copy, readonly) NSString *_Nonnull timestampString;Swift
var timestampString: String { get } -
Returns the interval between the timestamp and 00:00:00 UTC on 1 January 1970.
Declaration
Objective-C
@property (nonatomic, readonly) NSTimeInterval timeIntervalSince1970;Swift
var timeIntervalSince1970: TimeInterval { get }
View on GitHub