make time calculations timezone independent (and thus more portable) (#1337)
Sven Nierlein
notifications at github.com
Thu Apr 23 10:25:19 CEST 2015
I am trying to reproduce that here:
%> TZ=UTC ./check_http -v -p443 -H github.com -C 7,3 --sni
OK - Certificate 'github.com' will expire on Tue 12 Apr 2016 12:00:00 PM
UTC.
%> ./check_http -v -p443 -H github.com -C 7,3 --sni
OK - Certificate 'github.com' will expire on Tue 12 Apr 2016 01:00:00 PM
CEST.
%> TZ=Europe/Berlin ./check_http -v -p443 -H github.com -C 7,3 --sni
OK - Certificate 'github.com' will expire on Tue 12 Apr 2016 01:00:00 PM
CEST.
%> ./check_http -V
check_http v2.1.1.51.g08fc (monitoring-plugins 2.1.1)
I'd say, the real question is, why is there no timezone mentioned in your
output. The check uses strftime with "%c" fomat. This is "The preferred date
and time representation for the current locale.".
So, if i set LANG as well, i get close to your results:
LANG=C TZ=Europe/Berlin ./check_http -v -p443 -H github.com -C 7,3 --sni
OK - Certificate 'github.com' will expire on Tue Apr 12 13:00:00 2016.
Which is not wrong, but you have to know the timezone :-)
In the end, i would leave it like it is. With every ENV variable we set to a
fixed value, we just trade reduced flexibility for a specific use case.
--
Reply to this email on GitHub:
https://github.com/monitoring-plugins/monitoring-plugins/pull/1337#issuecomment-95487885
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-plugins.org/archive/devel/attachments/20150423/adc8b2d5/attachment.html>
More information about the Devel
mailing list