Re: make time calculations timezone independent (and thus more portable) (#1337)

Sven Nierlein <[email protected]>
Newsgroups gmane.network.nagios.devel
Message-ID <monitoring-plugins/monitoring-plugins/pull/1337/[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.