Commit Graph

92 Commits

Author SHA1 Message Date
Jeroen van Rijn fda283c55e More better validation. 2024-03-20 23:09:09 +01:00
Jeroen van Rijn ed5fd15f6e Ensmallen Date struct. 2024-03-20 18:13:29 +01:00
Jeroen van Rijn 89ca15014c Ensmallen Time struct. 2024-03-20 18:09:07 +01:00
Jeroen van Rijn 9c144dd24f Change Ordinal from int to i64 2024-03-20 17:56:22 +01:00
Jeroen van Rijn 72c15d7699 Add WiP datetime package and tests.
A new package `core:time/datetime` has been added which can represent moments much further in the past and future than `core:time`.
It is based on *the* reference work on the subject, Calendrical Calculations Ultimate Edition, Reingold & Dershowitz.

More procedures will be added to it in the future, to for example calculate the 3rd Thursday in March to figure out holidays.
The package has been tested for more than a year and can handle dates 25 quadrillion years into the past and future with 64-bit day ordinals, or 5 million with 32-bit ones.

This also fixes a longstanding bug where converting between YYYY-MM:DD hh:mm:ss and `time.Time` and back could result in a mismatch.

RFC 3339 timestamps can now also be parsed using the `core:time` package.
2024-03-18 16:47:16 +01:00
avanspector f92042e7dd Merge branch 'odin-lang:master' into haiku 2024-03-01 00:42:28 +01:00
gingerBill 6805b85f89 Fix leap year bug 2024-02-29 20:20:37 +00:00
avanspector c3746d9f56 fix core and libc 2024-02-25 03:32:35 +01:00
gingerBill 9a16bc5fc5 Remove core:os dependency for base:runtime 2024-01-28 22:40:46 +00:00
gingerBill 3e7e779abf Replace core:* to base:* where appropriate 2024-01-28 22:18:51 +00:00
flysand7 4d65b1ab9c Implement new sys/unix package 2023-10-27 10:51:21 +11:00
Damian Tarnawski c19af95db0 Fix calling time.now() in wasm js runtime 2023-10-19 18:45:04 +02:00
gingerBill 44ea82f845 Clean up usage of using throughout core and vendor 2023-07-31 11:46:40 +01:00
Jeroen van Rijn 0f9e747583 Merge pull request #2520 from matias-eduardo/master
Allow for custom sleep duration in tsc frequency fallback
2023-05-09 23:03:47 +02:00
Matias Fernandez 57c14f6a9b Allow custom sleep on tsc fallback.
This gives the user more control over the spectrum of precision vs. load time on Windows. Spall's output with much lower sleep times is still useful in my experience.

NOTE: A better API might be to allow the user to pass the freq as a param to "create_context" in case they already paid for it beforehand, but this seems fine for now.
2023-05-09 00:03:58 -04:00
Laytan Laats c47dcbbe2f fix spacing 2023-05-06 19:39:39 +02:00
Laytan Laats 956ffdf654 add time.weekday proc 2023-05-05 20:55:59 +02:00
Colin Davidson afaa5f2deb add null-impl for tsc_frequency for alt-platforms 2023-03-04 22:40:14 -08:00
Colin Davidson c6f463b8c9 shuffle tsc around a little 2023-02-22 12:28:24 -08:00
Colin Davidson 8e5e43f335 add sleep-fallback and invariant check 2023-02-21 17:48:49 -08:00
Colin Davidson 91dccf8d62 more function name changes 2023-02-21 06:46:36 -08:00
Colin Davidson 1fc3a25f47 block all x86 tsc functions in when block 2023-02-21 06:28:55 -08:00
Colin Davidson 7322b63991 adjust func names 2023-02-21 06:22:19 -08:00
Colin Davidson f860b09065 use the libc call on darwin so sysctlbyname works 2023-02-21 05:38:07 -08:00
Colin Davidson 45b742be23 sort out units to make things happier 2023-02-19 20:50:30 -08:00
Colin Davidson d325ee4b91 more typo. yay. 2023-02-19 20:45:56 -08:00
Colin Davidson 87d6910bb8 intrinsics typo 2023-02-19 20:44:49 -08:00
Colin Davidson 9c9300ed58 derp. raw-syscalls 2023-02-19 20:44:00 -08:00
Colin Davidson e559cf32fe oops, add intrinsics import 2023-02-19 20:39:36 -08:00
Colin Davidson fb735883be add a tsc frequency get for windows 2023-02-19 20:33:48 -08:00
Colin Davidson 6a2ef1f4f3 add osx support 2023-02-19 20:23:35 -08:00
Colin Davidson 051c9cb564 begin adding tsc frequency getters 2023-02-19 20:08:11 -08:00
JopStro dad10ef800 create _yeild stub for wasi_wasm32 target to avoid compile error 2022-10-31 21:22:55 +00:00
gingerBill 7bcde35651 Heavily improve time handling on Windows for time.now() and os.File_Info 2022-10-26 16:05:49 +01:00
gingerBill fb49841b1d Remove strings dependency from core:sys/windows 2022-06-02 13:02:16 +01:00
gingerBill 577fa2d29b Update time procedures for js targets 2022-05-21 16:35:06 +01:00
gingerBill f002857edc Clean up core:time to be consistent across all platforms 2022-05-12 15:47:24 +01:00
gingerBill 6f20b5bb59 Add mock for _yield 2022-05-06 10:59:55 +01:00
Jeroen van Rijn 91037766d2 Update time.odin
Add caveats.
2022-04-16 16:48:08 +02:00
hikari 8bf73950fa time: remove unnecessary yield 2022-04-16 14:36:48 +03:00
hikari 4f4793817c time: fix unix build 2022-04-16 14:35:49 +03:00
hikari 0a0440a6e8 time: yield accurate_sleep instead of relaxing the cpu 2022-04-16 14:08:37 +03:00
hikari b05fbaacda time: add accurate sleep procedure 2022-04-16 00:32:17 +03:00
Sébastien Marie 5676c9e7eb initial OpenBSD support 2022-02-25 08:49:25 +00:00
gingerBill 3d7d347192 Convert ODIN_OS and ODIN_ARCH to use enums rather than use strings 2022-01-20 19:56:05 +00:00
gingerBill 518460af66 Begin work in semi-standardized js_wasm32 target 2021-11-07 19:56:01 +00:00
Phil H e4ce017183 better naming conventions for stopwatch procedures + fields 2021-10-28 14:08:21 -07:00
Phil bbccf9ddbf Add clock overloads for Duration and Stopwatch 2021-10-28 14:08:21 -07:00
Phil a8425cfb47 Add a stopwatch to time.odin 2021-10-28 14:08:21 -07:00
gingerBill 0d258e8b55 Make many package time procedures use "contextless" calling convention 2021-10-11 20:08:38 +01:00