Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python-rrdtool, how to create graphs in UTC time zone

I am using python-rrdtool to generate graphs from rrd files, it is by default generating graphs in CST time zone. How can i change the default time zone to UTC.

I found that setting the TZ env variable can do the trick. How can i do this using python-rrdtool ?

I followed this tutorial to create graphs using python-rrdtool

Thank You

like image 739
Ramesh Raithatha Avatar asked Jun 26 '26 01:06

Ramesh Raithatha


1 Answers

Never mind, I found the solution,

To set the TZ variable using python, you need to add the below lines to your python script where you are generating your rrd graphs -

import time, os
os.environ['TZ'] = "Asia/Kolkata"   # timezone you want to display graphs in
time.tzset()
like image 65
Ramesh Raithatha Avatar answered Jun 28 '26 14:06

Ramesh Raithatha



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!