FHIRTime
public struct FHIRTime: DateAndTime
A time during the day, optionally with seconds, usually for human communication. Named FHIRTime
to match with FHIRDate
.
Minimum of 00:00 and maximum of < 24:00. There is no timezone. Since decimal precision has significance in FHIR, Time initialized from a string will remember the seconds string until it is manually set.
-
The hour of the day; cannot be higher than 23.
Declaration
Swift
public var hour: UInt8
-
The minute of the hour; cannot be larger than 59
Declaration
Swift
public var minute: UInt8
-
The second of the minute; must be smaller than 60
Declaration
Swift
public var second: Double?
-
If initialized from string, this was the string for the seconds; we use this to remember precision.
Declaration
Swift
public internal(set) var tookSecondsFromString: String?
-
An optional id of the element.
Declaration
Swift
public var id: String?
-
The parent/owner of the receiver, if any. Used to dereference resources.
Declaration
Swift
public weak var _owner: FHIRAbstractBase?
-
Optional extensions of the element.
Declaration
Swift
public var extension_fhir: [Extension]?
-
The clock time of right now.
Declaration
Swift
public static var now: FHIRTime
-
Designated initializer. Overflows seconds and minutes to arrive at the final time, which must be less than 24:00:00 or it will be capped.
The
secondsFromString
parameter will be discarded if it is negative or higher than 60.Declaration
Swift
public init(hour: UInt8, minute: UInt8, second: Double?, secondsFromString: String? = nil)
Parameters
hour
Hour of day, cannot be greater than 23 (a time of 24:00 is illegal)
minute
Minutes of the hour; if greater than 59 will roll over into hours
second
Seconds of the minute; if 60 or more will roll over into minutes and discard
secondsFromString
secondsFromString
If time was initialized from a string, you can provide the seconds string here to ensure precision is kept. You are responsible to ensure that this string actually represents what’s passed into
seconds
. -
Initializes a time from a time string by passing it through
DateAndTimeParser
.Will fail unless the string contains at least hour and minute.
Declaration
Swift
public init?(string: String)
-
Declaration
Swift
public init(json: JSONType, owner: FHIRAbstractBase?, context: inout FHIRInstantiationContext)
Parameters
json
The value in its associated
JSONType
owner
Optional, the owning element
context
An in-out parameter for the instantiation context
-
Declaration
Swift
public func asJSON(errors: inout [FHIRValidationError]) -> JSONType
Parameters
errors
Errors encountered during serialization
Return Value
The FHIRJSON reperesentation of the receiver
TODO: this implementation uses a workaround using string coercion instead of format: "%02d:%02d:%@" because %@ with String is not
-
Declaration
Swift
public var description: String
-
Declaration
Swift
public static func ==(lhs: FHIRTime, rhs: FHIRTime) -> Bool
Parameters
lhs
A value to compare.
rhs
Another value to compare.
-
Declaration
Swift
public static func <(lhs: FHIRTime, rhs: FHIRTime) -> Bool
Parameters
lhs
A value to compare.
rhs
Another value to compare.