@@ -627,12 +627,20 @@ public final class UnitDuration : Dimension {
627
627
*/
628
628
629
629
private struct Symbol {
630
+ static let picoseconds = " ps "
631
+ static let nanoseconds = " ns "
632
+ static let microseconds = " µs "
633
+ static let milliseconds = " ms "
630
634
static let seconds = " s "
631
635
static let minutes = " m "
632
636
static let hours = " h "
633
637
}
634
638
635
639
private struct Coefficient {
640
+ static let picoseconds = 1e-12
641
+ static let nanoseconds = 1e-9
642
+ static let microseconds = 1e-6
643
+ static let milliseconds = 1e-3
636
644
static let seconds = 1.0
637
645
static let minutes = 60.0
638
646
static let hours = 3600.0
@@ -642,6 +650,30 @@ public final class UnitDuration : Dimension {
642
650
self . init ( symbol: symbol, converter: UnitConverterLinear ( coefficient: coefficient) )
643
651
}
644
652
653
+ public class var picoseconds : UnitDuration {
654
+ get {
655
+ return UnitDuration ( symbol: Symbol . picoseconds, coefficient: Coefficient . picoseconds)
656
+ }
657
+ }
658
+
659
+ public class var nanoseconds : UnitDuration {
660
+ get {
661
+ return UnitDuration ( symbol: Symbol . nanoseconds, coefficient: Coefficient . nanoseconds)
662
+ }
663
+ }
664
+
665
+ public class var microseconds : UnitDuration {
666
+ get {
667
+ return UnitDuration ( symbol: Symbol . microseconds, coefficient: Coefficient . microseconds)
668
+ }
669
+ }
670
+
671
+ public class var milliseconds : UnitDuration {
672
+ get {
673
+ return UnitDuration ( symbol: Symbol . milliseconds, coefficient: Coefficient . milliseconds)
674
+ }
675
+ }
676
+
645
677
public class var seconds : UnitDuration {
646
678
get {
647
679
return UnitDuration ( symbol: Symbol . seconds, coefficient: Coefficient . seconds)
0 commit comments