@@ -627,12 +627,20 @@ public final class UnitDuration : Dimension {
627627 */
628628
629629 private struct Symbol {
630+ static let picoseconds = " ps "
631+ static let nanoseconds = " ns "
632+ static let microseconds = " µs "
633+ static let milliseconds = " ms "
630634 static let seconds = " s "
631635 static let minutes = " m "
632636 static let hours = " h "
633637 }
634638
635639 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
636644 static let seconds = 1.0
637645 static let minutes = 60.0
638646 static let hours = 3600.0
@@ -642,6 +650,30 @@ public final class UnitDuration : Dimension {
642650 self . init ( symbol: symbol, converter: UnitConverterLinear ( coefficient: coefficient) )
643651 }
644652
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+
645677 public class var seconds : UnitDuration {
646678 get {
647679 return UnitDuration ( symbol: Symbol . seconds, coefficient: Coefficient . seconds)
0 commit comments