Hi,
What is the reason why https://esp-idf.readthedocs.io/en/lates ... _get_timev returns int64_t instead of uint64_t?
esp_timer_get_time return type
Re: esp_timer_get_time return type
Uinx time representation for dates before Thursday, 1 January 1970 are negative, for example
-1000000 -> Sat, 20 Dec 1969 10:13:20 GMT
-1000000 -> Sat, 20 Dec 1969 10:13:20 GMT
Re: esp_timer_get_time return type
The reason was that the return type represents a moment in time, relative to some point (startup). So time can be both positive and negative, even if this function only ever returns positive values. This is similar to time_t being signed on most systems even though time() always returns positive values, unless one has a time machine. With a 64-bit type, loss of one bit of range would not matter in practice, plus arithmetic with signed types is less error prone.
Re: esp_timer_get_time return type
I should have looked at commit message, thank you!
Who is online
Users browsing this forum: No registered users and 123 guests