twekkel / htpdate

HTTP Time protocol
https://www.vervest.org/htp
Other
50 stars 13 forks source link

htpdate: removing custom epoch function #14

Closed angeloc closed 2 years ago

angeloc commented 2 years ago

The epoch function return a wrong number of seconds, using the mktime function librery instead.

Fixes #13:

$ htpdate -t -s -d https://google.com google.com 443, 16 Jan 2022 18:04:01 GMT (89 ms) => 0 google.com 443, 16 Jan 2022 18:04:01 GMT (101 ms) => 0 google.com 443, 16 Jan 2022 18:04:01 GMT (67 ms) => 0 google.com 443, 16 Jan 2022 18:04:02 GMT (82 ms) => -1 when: 812500000, nap: -62500000 offset: 0.187500 Setting 0.188 seconds Set time: Sat Jan 1 18:04:02 2022

Signed-off-by: Angelo Compagnucci angelo.compagnucci@gmail.com

angeloc commented 2 years ago

@twekkel Could you release another version after this? Sorry so much for being so pedantic!

twekkel commented 2 years ago

mktime() assumes that the local TZ database is always correct... long time this was how htpdate time handled, until this bug

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=876687

so this is not the way to go.... need to fix the epoch() some how... see branch https://github.com/twekkel/htpdate/tree/Epoch

angeloc commented 2 years ago

@twekkel I strongly disagree on this. We are dealing with time, we must assume the tz database is correct.

twekkel commented 2 years ago

You can not assume it.... countries change time zone with a month notice sometimes, and before TZ is pickup up by the distribution takes longer. Turkey was a real live example that you can not trust TZ...

Web server timestamp is also always in GMT, that is what the RFC is telling... there is no room for timezones in htpdate.