Commit graph

72 commits

Author SHA1 Message Date
Oscar Nihlgård
f6df2d9956 Sub second time resolution (#6978)
* Add deprecation warnings to recently deprecated procs

* Fix bad usage of the times module

* Introduce sub second resolution

* Fix usage of C's time()

* Switch to nanosecond resolution

* Make Time & Duration opaque again and fix some errors

* Change back to TimeInterval for shorthands

* Fix JS test

* Fix build error for windows

* Undeprecate epochTime

* Documentation and minor changes

* Lots of bugfixes and doc comments

* Attempt to make travis & appveyor green

* Fix edge cases for dealing with the local timezone

* Workaround JS backend overflow/underflow bug

* Use better workaround for not knowing the size of time_t

* Use all available timezones for tests

* Fix indentation

* Add procs for accessing the fractional part of a duration

* Order time units from smallest to largest since it makes more sense

* Include months and years in `TimeUnit`

* Review fix
2018-04-13 07:36:30 +02:00
Yuriy Glukhov
1b3f640188 Fixed crash in rand (#7103) 2018-01-18 18:47:58 +01:00
GULPF
a879973081 Better times module (#6552)
* First work on better timezones

* Update tests to new api.
Removed tests for checking that `isDst` was included when formatting, since `isDst` no longer affects utc offset (the entire utc offset is stored directly in `utcOffset` instead).

* Deprecate getLocaltime & getGmTime
* Add `now()` as a shorthand for GetTIme().inZone(Local)
* Add FedericoCeratto's timezone tests (#6548)
* Run more tests in all timezones

* Make month enum start at 1 instead of 0
* Deprecate getDayOfWeekJulian
* Fix issues with gc safety
* Rename TimeInfo => DateTime
* Fixes #6465
* Improve isLeapYear
* FIx handling negative adjTime

* Cleanup:
- deprecated toSeconds and fromSeconds, added fromUnix and toUnix instead (that returns int64 instead of float)
- added missing doc comments
- removed some unnecessary JS specific implementations

* Fix misstake in JS `-` for Time

* Update usage of TimeEffect
* Removed unecessary use of `difftime`
* JS fix for local tz
* Fix subtraction of months
* Fix `days` field in `toTimeInterval`
* Style and docs
* Fix getDayOfYear for real this time...
* Fix handling of adding/subtracting time across dst transitions
* Fix some bad usage of the times module in the stdlib
* Revert to use proper time resoultion for seeding in random.nim
* Move deprecated procs to bottom of file
* Always use `epochTime` in `randomize`
* Remove TimeInterval normalization
* Fixes #6905

* Fix getDayOfWeek for year < 1
* Export toEpochDay/fromEpochDay and change year/month/monthday order
* Add asserts for checking that the monthday is valid
* Fix some remaining ambiguous references to `Time`
* Fix ambiguous reference to Time
2017-12-18 23:11:28 +01:00
Araq
8decf0f5ce make JS tests green again 2017-12-15 11:34:17 +01:00
Araq
196977f623 many improvements to random.nim; fixes #4726 2017-12-14 21:37:53 +01:00
Andreas Rumpf
b14cc1e3b2 fixes #6631 2017-10-30 14:45:57 +01:00
Andreas Rumpf
d52a1061b3 work in progress: new implementation for 'a[^1]' 2017-10-29 19:46:17 +01:00
Yuriy Glukhov
f3b3af5f3f Fixed randomize for 32bit target (#6167) 2017-08-01 19:53:12 +02:00
Fabian Keller
a6e0494a6f fixes #5966 2017-06-20 12:11:09 +02:00
Araq
2589d69ed2 fixes #5430 2017-02-26 00:32:07 +01:00
Vladar4
ea4397fbb0 fixed bug when the first random(max: float) call is the same value, regardless of randomize() (#5257) 2017-01-20 19:35:20 +01:00
Andreas Rumpf
767524d62a random.shuffle now takes an openArray proc 2017-01-11 06:13:27 +01:00
Benjamin Summerton
17c62bb545 Documented shuffle from random module (#5204) 2017-01-11 06:05:41 +01:00
Araq
6acfbb9e1d make random.nim work for the JS target again 2017-01-08 14:00:52 +01:00
Araq
13649778c1 random.nim: added shuffle proc; fixes 'mod' bias 2017-01-08 00:53:23 +01:00
Araq
5a64e1a531 random.nim: add a warning about crypo; refs #5047 2017-01-07 00:31:03 +01:00
Federico Ceratto
7d24656b0a Fix few typos 2016-10-17 13:12:15 +01:00
Matthew Baulch
50d6c0ae85 Random module: fix links, improve header. 2016-07-18 21:42:47 +10:00
Andreas Rumpf
1a88c01f92 documentation build cleaned up 2016-05-31 03:04:45 +02:00
Andreas Rumpf
3cedf3e887 make test green 2016-05-30 17:40:13 +02:00
Andreas Rumpf
95bb19a579 moved random procs from math to its own module (breaking change) 2016-05-30 16:24:52 +02:00
Andreas Rumpf
5575cfd3ec added pure Nim random stdlib module 2016-05-30 16:24:52 +02:00