summary refs log tree commit diff stats
path: root/lib/pure/times.nim
Commit message (Collapse)AuthorAgeFilesLines
* Linux abi take 3 (#5692)Jacek Sieka2017-04-121-10/+24
| | | | | * avoid generating object fields for imported types * fix some abi/type issues for linux_amd64
* Stdlib: Times: Use JS's "new Date" to convert TimeInfo to Time.Konstantin Molchanov2017-03-291-260/+253
| | | | To use JS's Date creation from string, I moved the TimeInfo formatting code above the toTime proc declaration. Also, I changed the argument type for newDate from string to cstring for it to work.
* Merge branch 'calculate_yearday_in_timeinfo_js' into fix_time_offset_in_times_jsKonstantin Molchanov2017-03-271-2/+8
|\
| * Times: JS: Add yearday to TimeInfo.Konstantin Molchanov2017-03-271-2/+8
| | | | | | | | | | | | Add yearday calculation to getLocalTime and getGMTime, so that yearday is not 0 for TimeInfo instances under JS backend. Yearday 0 has no sense and contradicts the behaviour under C backend, where yearday is an int from 1 to 365, i.e. cannot be 0 even theoretically.
* | Times: JS: Remove implicit UTC convesion.Konstantin Molchanov2017-03-261-1/+1
|/ | | | The conversion would produce incorrect timestamp.
* JS: Times: Add timezone prop to TimeInfo. (#5581)Konstantin Molchanov2017-03-251-0/+1
|
* fixes 4804Simon Krauter2017-01-061-10/+4
| | | toTime(): Use the Windows-specific part for every OS, because it gives correct results on Linux too. The removed code for Linux gives wrong results.
* bcc uses _timezone like vccAdrianV2016-12-281-1/+1
|
* Merge branch 'devel' into sighashesAraq2016-12-061-6/+18
|\
| * Revert @endragor's fix for WindowsDmitry Polienko2016-12-061-14/+16
| | | | | | | | | | | | | | | | | | _mkgmtime is not supported by mingw because of the older msvcrt versions. Fortunately, mktime implementation in Windows is just broken enough to make the initial implementation work... As far as I can tell, this works with both *nix-like platforms and Win, and fixes #4690
| * Fix TimeInfo to Time conversion. Fixes #5065.Ruslan Mustakov2016-11-301-10/+15
| |
* | times.nim: remove code duplicationAraq2016-11-291-8/+2
|/
* Updated times.parse() documentationFelix Krause2016-11-141-3/+6
|
* Parse 'Z' as valid timezone if offset is expectedFelix Krause2016-11-141-3/+15
|
* Assume local DST iff no timezone is givenFelix Krause2016-11-141-3/+16
|
* Improved `-`; fixed testsFelix Krause2016-11-141-18/+15
| | | | | | * added prefix `-` operator for TimeInterval * improved `-` for both TimeInterval and TimeInfo * Fixed a DST test
* Fixed daylight saving timeFelix Krause2016-11-141-19/+16
| | | | | | | | | * 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
* Fixed timezone rendering, added testFelix Krause2016-11-101-4/+5
|
* Fixed timezone sign errorFelix Krause2016-11-081-6/+6
| | | | | * This was introduced in recent "cosmetic" fix. Not so cosmetic after all…
* Merge pull request #5002 from goldenreign/time-compare-nosideeffectAndreas Rumpf2016-11-071-5/+5
|\ | | | | Add 'noSideEffect' pragma for Time type's operators. Fixes #4981
| * Fix `-` operator for Time type for JS targetgoldenreign2016-11-071-1/+1
| |
| * Add 'noSideEffect' pragma for Time type's operatorsgoldenreign2016-11-071-4/+4
| |
* | More cosmetic changesFelix Krause2016-11-071-20/+11
| | | | | | | | | | | | * Don't use factor var, it's overly complicated * Removed proc that's now unused * Better documented timezone field
* | Cosmetic fixesFelix Krause2016-11-031-16/+17
| | | | | | | | | | | | * Improved comments * Improved spacing * Use consts instead of magic numbers
* | Use ISO 8601 format for times.`$`. Fixed tests.Felix Krause2016-11-011-46/+36
| | | | | | | | | | | | * `$` now uses format() with explicit time zone. * Fixed errors in rendering "z", "zz" and "zzz" * Updated tests
* | Removed tzname because it's brokenFelix Krause2016-11-011-32/+2
| | | | | | | | | | | | | | * 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
* | Fixed timezone offset parsingFelix Krause2016-11-011-10/+12
| |
* | Made times.nim compile again to JSFelix Krause2016-11-011-2/+1
| |
* | Fixed timezone handlingFelix Krause2016-11-011-55/+41
|/ | | | | | | | | | * mktime always interprets its input as local time even on systems where gmtoff is present, so using it is utterly useless for anything but getting the local timezone. Removed all other usage of gmtoff to avoid confusion. * Properly handle timezone offset in toTime() * Properly handle timezone offset in `$` because asctime also interprets its input as local time * Also tried to fix the JavaScript implementation
* change TimeImpl for MingWAraq2016-11-011-1/+1
|
* Fix #4922, bug in times.parse, mishandling DST.Jonathan Bernard2016-10-211-6/+12
|
* Bugfix for times.initInterval (issue #4889)Jonathan Bernard2016-10-121-8/+8
| | | | | | | | | | | | | | | | | | | | | | | `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) ```
* Calculate correct yearday in times.parseFelix Krause2016-08-191-2/+5
|
* stdlib and compiler don't use .immediate anymoreAndreas Rumpf2016-07-291-41/+22
|
* prepare Nim codebase for upcoming parser changesAndreas Rumpf2016-07-151-3/+3
|
* Fix times.`+` and `-` for TimeInfo and TimeInterval.Dominik Picheta2016-06-181-3/+9
|
* Time has now reference semantics on jsYuriy Glukhov2016-06-011-1/+2
|
* Adding OpenBSD to definescheatfate2016-05-301-4/+4
|
* Resolve #3059cheatfate2016-05-301-31/+76
| | | | Make getTimezone() to work properly on FreeBSD and NetBSD.
* Some documentation fixes in times module.Dominik Picheta2016-04-061-8/+15
|
* Deprecate timeToTimeInfo, add str->time procscoffeepots2016-04-061-36/+43
| | | | | | | | | | | | | | | | | | | | | | | * depreciate timeToTimeInfo, add str->time procs initTime allows creating times from strings. initTimeFromStr offers a default format string compatible with $Time. timeToTimeInterval changed to work properly. * Spell {.deprecated.} correctly * deprecated timeToTimeInfo, removed initTime procs Is it even worth depreciating timeToTimeInfo rather than just removing it, considering it's just wrong and we have getLocalTime and getGMTime that actually work? Also, if I'm renaming timeToTimeInfo -> toTimeInfo etc, isn't the deprecated tag kind of redundant? * Updated names for toTime and toTimeInterval procs * Added type to toTime template This should allow compilation of os.nim now that toTime is defined in times.nim. * Updated toTime template to use {.gensym.} Local templates default to 'bind' semantics, not 'gensym'. This was causing a failure to 'see' the local toTime template.
* SpellcheckFederico Ceratto2016-02-291-1/+1
|
* Fixed issue 3905 with getTimezone in jsAnatoly Galiulin2016-02-261-1/+1
|
* Fixed TimeInterval bug.Dominik Picheta2016-01-081-6/+9
|
* Fixed ttime test. Improved docs in times module.Dominik Picheta2016-01-081-3/+16
|
* add timeinterval helping functions as per issue #3609JamesP2015-12-081-22/+130
| | | | | | | | | | 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
* Add comment at end of file on where to find further testsJamesP2015-12-011-0/+3
|
* Removal of tests from times module, that have been moved to ttime.nim test fileJamesP2015-12-011-116/+4
|
* added an assertionAraq2015-10-271-1/+3
|
* Example: add extra getGmTime interval addition exampleJamesP2015-09-101-1/+2
|