Skip to content

Conversation

@CorruptedVor
Copy link
Contributor

@CorruptedVor CorruptedVor commented Sep 11, 2025

The cast to double leads to a potential loss of significant digits.
64-bit long should be enough, overflow in 2262-04-11 from 23:47:16 to 23:47:17
0x7fffffffffffffff - (9223372037 * 1000000000) < 0, 9223372037 corresponds to 2262

uint64_t is more appropriate, considering CLOCK_REALTIME is going to be returning timestamps after 1970 (positive), 32-bit long (the case on 32-bit platforms) suffers (2^32 / 1000000000) < 5, always overflowing in today's age

from-type and to-type conversions:
only some of them are missing, it's trivial to add all of them
perhaps we should make the carp compiler output the definitions automatically

@CorruptedVor CorruptedVor changed the title fix(core): System_nanotime shouldn't return long fix(core): System_nanotime incorrectly returns double Sep 11, 2025
@CorruptedVor CorruptedVor marked this pull request as ready for review September 11, 2025 17:54
@CorruptedVor CorruptedVor force-pushed the patch-3 branch 2 times, most recently from 3f30ba7 to 79440f1 Compare September 11, 2025 18:05
@eriksvedang
Copy link
Collaborator

Hi, sorry I missed the notifications for your PRs. Will look into them asap! Cheers

@eriksvedang eriksvedang merged commit adfad13 into carp-lang:master Sep 16, 2025
0 of 4 checks passed
@CorruptedVor CorruptedVor deleted the patch-3 branch September 16, 2025 08:56
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