diff options
Diffstat (limited to 'lib/pure/times.nim')
-rw-r--r-- | lib/pure/times.nim | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/pure/times.nim b/lib/pure/times.nim index 8074c09e8..6dc56b08a 100644 --- a/lib/pure/times.nim +++ b/lib/pure/times.nim @@ -17,7 +17,8 @@ resolution used by ``getTime()`` depends on the platform and backend (JS is limited to millisecond precision). - Examples: + Examples + ======== .. code-block:: nim import times, os @@ -38,7 +39,7 @@ echo "One month from now : ", now() + 1.months Parsing and Formatting Dates - ---------------------------- + ============================ The ``DateTime`` type can be parsed and formatted using the different ``parse`` and ``format`` procedures. @@ -128,7 +129,7 @@ only for years in the range 1..9999). Duration vs TimeInterval - ---------------------------- + ============================ The ``times`` module exports two similiar types that are both used to represent some amount of time: `Duration <#Duration>`_ and `TimeInterval <#TimeInterval>`_. @@ -137,7 +138,7 @@ needed). Duration - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ---------------------------- A ``Duration`` represents a duration of time stored as seconds and nanoseconds. A ``Duration`` is always fully normalized, so ``initDuration(hours = 1)`` and ``initDuration(minutes = 60)`` are equivilant. @@ -147,7 +148,7 @@ is more performant and easier to understand it should generally prefered. TimeInterval - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ---------------------------- A ``TimeInterval`` represents some amount of time expressed in calendar units, for example "1 year and 2 days". Since some units cannot be normalized (the length of a year is different for leap years for example), @@ -164,7 +165,7 @@ ``Duration`` doesn't have. How long is a day? - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ---------------------------- It should be especially noted that the handling of days differs between ``TimeInterval`` and ``Duration``. The ``Duration`` type always treats a day as exactly 86400 seconds. For ``TimeInterval``, it's more complex. |