Commit Graph

17 Commits

Author SHA1 Message Date
Felix Krause
434c27343e Parse 'Z' as valid timezone if offset is expected 2016-11-14 18:46:35 +01:00
Felix Krause
aa08c32c2b Improved -; fixed tests
* added prefix `-` operator for TimeInterval
 * improved `-` for both TimeInterval and TimeInfo
 * Fixed a DST test
2016-11-14 18:28:55 +01:00
Felix Krause
544a2cfe1a Fixed daylight saving time
* When formatting timezone, substract 1 hour from timezone when isDST
 * Do not depend DST in current timezone when parsing arbitrary date
   because formatted timestamps are never in DST.
 * On the way, removed an unnecessary line in parsing code which could
   cause bugs.
 * Added DST tests
2016-11-14 18:28:55 +01:00
Felix Krause
91a0674961 Fixed timezone rendering, added test 2016-11-10 19:03:46 +01:00
Andreas Rumpf
4c79583a95 Merge pull request #5002 from goldenreign/time-compare-nosideeffect
Add 'noSideEffect' pragma for Time type's operators. Fixes #4981
2016-11-07 16:52:34 +01:00
goldenreign
554105ff7c Add 'noSideEffect' pragma for Time type's operators 2016-11-07 12:14:28 +07:00
Felix Krause
9d5de8021b Use ISO 8601 format for times.$. Fixed tests.
* `$` now uses format() with explicit time zone.
 * Fixed errors in rendering "z", "zz" and "zzz"
 * Updated tests
2016-11-01 21:14:52 +01:00
Felix Krause
170745eb39 Removed tzname because it's broken
* No mapping between TimeInfo.tzname and TimeInfo.timezone
 * tzname of time.h is not well-defined, may have almost arbitrary
   length, and localization may differ
 * Code used hardcoded "UTC" string
2016-11-01 20:26:50 +01:00
Jonathan Bernard
b7232bd425 Fix #4922, bug in times.parse, mishandling DST. 2016-10-21 17:06:36 -05:00
Jonathan Bernard
68d3486f5a Bugfix for times.initInterval (issue #4889)
`initInterval` had logic to calculate and carry overflowed fields (65 seconds
turns into 5 seconds and carries 1 minute). However, we were not including that
carried value when we recalculate the carry over for the next period of time.So
if you had, for example, 3600 seconds, we carried 60 minutes into the minutes
calculation, but when we calculated how much we should carry into the hours
value we only considered what the user originally supplied for the minutes
field, and forgot to include those 60 carried minute.

So, for example, with the previous implementation this was true:

`seconds(60 * 60 * 24) == seconds(0)`

Or, as failing tests:

```nimrod
import times

assert seconds(60 * 60 * 24) != seconds(0)
assert seconds(60 * 60 * 24) == days(1)
```
2016-10-12 15:44:21 -05:00
Felix Krause
932abc7bf8 Improved times tests
* Added check for yearday
 * Changed some test dates to check different equivalence classes of
   yearday (before leap day, at leap day, after february in leap year,
   after february in non-leap year)
2016-08-21 14:19:22 +02:00
Dominik Picheta
fffdae32c7 Fixed TimeInterval bug. 2016-01-08 11:54:34 +00:00
Dominik Picheta
09b159b816 Fixed ttime test. Improved docs in times module. 2016-01-08 11:46:11 +00:00
JamesP
8af8f7673b add timeinterval helping functions as per issue #3609
add tests to ttime.nim for timeinterval add/subtract functionality

Changed assert to doAssert in ttime.nim
Added extra tests to ttime.nim
Removal of singular help procs for working with TimeIntervals
Added TimeIin proc toSeconds(a: TimeInfo, interval: TimeInterval) where subtracting a year gave wrong results
Add overflow of units on initInterval eg, 65 seconds is 5 seconds and 1 minute
2015-12-08 10:16:42 +10:00
JamesP
c660a7f942 add assertion tests from times module to ttime.nim test file in tests\stdlib 2015-12-01 18:07:31 +10:00
Adam Strzelecki
e80465dacf tests: Trim .nim files trailing whitespace
via OSX: find . -name '*.nim' -exec sed -i '' -E 's/[[:space:]]+$//' {} +
2015-09-04 23:04:32 +02:00
Araq
20b5f31c03 new tester; all tests categorized 2014-01-13 02:10:03 +01:00