View Javadoc
1   package org.djunits.unit;
2   
3   import org.djunits.unit.quantity.Quantity;
4   import org.djunits.unit.scale.IdentityScale;
5   import org.djunits.unit.si.SIPrefixes;
6   import org.djunits.unit.unitsystem.UnitSystem;
7   
8   /**
9    * Standard duration units.
10   * <p>
11   * Copyright (c) 2015-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
12   * BSD-style license. See <a href="https://djunits.org/docs/license.html">DJUNITS License</a>
13   * </p>
14   * @author <a href="https://www.tudelft.nl/averbraeck">Alexander Verbraeck</a>
15   */
16  public class DurationUnit extends Unit<DurationUnit>
17  {
18      /** */
19      private static final long serialVersionUID = 20140607L;
20  
21      /** The base, with "s" as the SI signature. */
22      public static final Quantity<DurationUnit> BASE = new Quantity<>("Duration", "s");
23  
24      /** The SI unit for duration is second. */
25      public static final DurationUnitl#DurationUnit">DurationUnit SI = new DurationUnit().build(
26              new Unit.Builder<DurationUnit>().setQuantity(BASE).setId("s").setName("second").setUnitSystem(UnitSystem.SI_BASE)
27                      .setSiPrefixes(SIPrefixes.UNIT, 1.0).setScale(IdentityScale.SCALE).setAdditionalAbbreviations("sec"));
28  
29      /** second. */
30      public static final DurationUnit SECOND = SI;
31  
32      /** microsecond. */
33      public static final DurationUnit MICROSECOND =
34              SI.deriveLinear(1.0E-6, "mus", "microsecond", UnitSystem.SI_DERIVED, "\u03BCs", "mus", "\u03BCsec", "musec");
35  
36      /** millisecond. */
37      public static final DurationUnit MILLISECOND =
38              SI.deriveLinear(1.0E-3, "ms", "millisecond", UnitSystem.SI_DERIVED, "ms", "ms", "msec");
39  
40      /** minute. */
41      public static final DurationUnit MINUTE = SI.deriveLinear(60.0, "min", "minute", UnitSystem.SI_ACCEPTED, "min", "min");
42  
43      /** hour. */
44      public static final DurationUnit HOUR =
45              MINUTE.deriveLinear(60.0, "h", "hour", UnitSystem.SI_ACCEPTED, "h", "h", new String[] {"hr", "hour"});
46  
47      /** day. */
48      public static final DurationUnit DAY = HOUR.deriveLinear(24.0, "day", "day", UnitSystem.SI_ACCEPTED, "day", "day");
49  
50      /** week. */
51      public static final DurationUnit WEEK =
52              DAY.deriveLinear(7.0, "wk", "week", UnitSystem.OTHER, "wk", "wk", new String[] {"week"});
53  
54  }