Commit Graph

51 Commits

Author SHA1 Message Date
Colin Davidson
a6502c3e8c Initial cut of timezones 2024-10-09 19:26:43 -07:00
Feoramund
f6f2c67f37 Add time.time_to_datetime 2024-09-03 00:55:09 -04:00
Jeroen van Rijn
daa0779c01 Rewrite compound_to_time without using i128. 2024-08-20 18:50:05 +02:00
Jeroen van Rijn
bf53d2f6db Fix time.precise_clock on 32-bit platforms. 2024-08-10 12:44:40 +02:00
Jeroen van Rijn
d267735d99 Fixed time.precise_clock 2024-08-10 12:35:58 +02:00
Jeroen van Rijn
be7a1f671c Revert "Add time.precise_clock_from_time + time.precise_clock_from_duration"
This reverts commit c9ca192f33.
2024-08-10 03:26:09 +02:00
Jeroen van Rijn
c9ca192f33 Add time.precise_clock_from_time + time.precise_clock_from_duration 2024-08-10 03:23:08 +02:00
Jeroen van Rijn
00c6b83537 Use constants in example. 2024-07-25 21:02:38 +02:00
Jeroen van Rijn
ca7d86084e Improve docs. 2024-07-25 20:58:47 +02:00
Jeroen van Rijn
9088a493d9 Add time.to_string* formatters. 2024-07-25 19:43:42 +02:00
Jeroen van Rijn
9cad8179b7 Clarify core:time Unix timestamp 2024-07-22 20:00:25 +02:00
flysand7
b3ca2d5e0a [time]: Document all functions 2024-07-20 18:48:50 +11:00
Jeroen van Rijn
3af9d31bd5 Add time.from_nanoseconds 2024-06-23 00:19:24 +02:00
gingerBill
3a9b86628a Add @(rodata) and @(static, rodata) where appropriate 2024-06-06 15:23:52 +01:00
blob1807
8eed65ad4c Update time.odin 2024-03-26 11:20:05 +10:00
blob1807
bc0a2b8d39 Update time.odin 2024-03-26 11:17:44 +10:00
blob1807
a405c72d4d Updated windows time period call
Updated win32.time_begin_period to windows.timeBeginPeriod
Added a note about calling windows.timeEndPeriod once you don't need accurate_sleep, as per MS's docs https://learn.microsoft.com/en-us/windows/win32/api/timeapi/nf-timeapi-timebeginperiod#remarks
2024-03-26 11:13:27 +10: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
gingerBill
6805b85f89 Fix leap year bug 2024-02-29 20:20:37 +00:00
gingerBill
3e7e779abf Replace core:* to base:* where appropriate 2024-01-28 22:18:51 +00:00
gingerBill
44ea82f845 Clean up usage of using throughout core and vendor 2023-07-31 11:46:40 +01: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
gingerBill
7bcde35651 Heavily improve time handling on Windows for time.now() and os.File_Info 2022-10-26 16:05:49 +01:00
gingerBill
f002857edc Clean up core:time to be consistent across all platforms 2022-05-12 15:47:24 +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
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
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
251da264ed Remove unneeded semicolons from the core library 2021-08-31 22:21:13 +01:00
gingerBill
f0437a4242 Enforce core:builtin and core:intrinsics for imports 2021-08-21 13:44:16 +01:00
Jeroen van Rijn
2451014b6e datetime_to_time's ok should default to true. 2021-05-02 13:23:57 +02:00
gingerBill
72aa0e6e38 Replace many foreign llvm calls with intrinsics 2021-04-25 20:22:26 +01:00
Jeroen van Rijn
06c5a7fb3e Correct overflowed months. 2021-03-23 18:49:50 +01:00
Jeroen van Rijn
781f784375 Add core:datetime_to_time
datetime_to_time takes separate parameters for date and time values and returns a time.Time and an `ok` bool.

If the values are out of range, they're considered modulo and ok will be set to false.
2021-03-23 18:41:40 +01:00
gingerBill
b727b6438b Minimize unneeded casts 2021-03-03 14:31:17 +00:00
gingerBill
aa93305015 Replace usage of inline proc with #force_inline proc in the core library 2021-02-23 16:14:47 +00:00
gingerBill
aed63a6e8b Update package reflect 2021-01-27 15:27:59 +00:00
gingerBill
9e8c46b8de Add time.Tick for performance related timings 2021-01-09 01:08:16 +00:00
gingerBill
8cc5cd1494 Add package path/filepath; Add os.stat for windows (TODO: unix) 2020-09-25 20:20:53 +01:00
gingerBill
fc4fdd588e Remove usage of do in core library 2020-09-23 17:17:14 +01:00
gingerBill
1f2f3cb315 Fix #712 2020-08-26 22:40:03 +01:00
gingerBill
509e8b512f Add time.read_cycle_counter 2020-06-22 15:54:19 +01:00
gingerBill
c9d3b95b0d Fix time.now 2020-06-19 11:35:43 +01:00
gingerBill
e92fdb4a99 x if cond else y and x when cond else y expressions 2020-03-05 20:34:30 +00:00
thebirk
ca2220214e Added diff() to core:time. 2019-01-06 19:40:57 +01:00