Skip to content

refactor: use DateTimeOffset for Unix timestamp calculations#1701

Open
unsafePtr wants to merge 1 commit into
bassmaster187:masterfrom
unsafePtr:refactor/datetime-unix-epoch
Open

refactor: use DateTimeOffset for Unix timestamp calculations#1701
unsafePtr wants to merge 1 commit into
bassmaster187:masterfrom
unsafePtr:refactor/datetime-unix-epoch

Conversation

@unsafePtr
Copy link
Copy Markdown

@unsafePtr unsafePtr commented Apr 24, 2026

Replace hardcoded new DateTime(1970, 1, 1, ...) with DateTimeOffset built-in methods (ToUnixTimeSeconds, ToUnixTimeMilliseconds, FromUnixTimeMilliseconds). Works on Mono and all .NET targets without any polyfill.

@unsafePtr unsafePtr force-pushed the refactor/datetime-unix-epoch branch from 60c2519 to 01a1eb9 Compare April 24, 2026 23:30
@bassmaster187
Copy link
Copy Markdown
Owner

Hi, did you test it on mono with raspberry or .net8 on docker / raspberry

@unsafePtr unsafePtr force-pushed the refactor/datetime-unix-epoch branch from 01a1eb9 to 1f412ec Compare April 27, 2026 07:27
@unsafePtr unsafePtr force-pushed the refactor/datetime-unix-epoch branch from 1f412ec to 762da88 Compare April 27, 2026 07:29
@unsafePtr
Copy link
Copy Markdown
Author

@bassmaster187 , dropped polyfyll, it's not supproted in mono. Tested against mono docker instance

@unsafePtr unsafePtr changed the title refactor: use DateTime.UnixEpoch for Unix timestamp calculations refactor: use DateTimeOffset for Unix timestamp calculations Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants