Gap between System Time and Python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 17

Gap between System Time and Python

Why is there a Gap of 2 Hours between the System Time and the Time returned by the time-Module in Python? With daylight saving Time it should be only one Hour. This is independently from the Device I use (Laptop, Raspberry, Smartphone). https://code.sololearn.com/cpk4SIB2fmIB/?ref=app

18th Jun 2018, 12:16 PM
Sebastian Keßler
Sebastian Keßler - avatar
4 Answers
+ 7
gmtime returns current time in UTC. Appears to work fine for me.
18th Jun 2018, 12:24 PM
Hatsy Rei
Hatsy Rei - avatar
+ 3
Your code shows the standard time in gst. Each area has a different time zone. Eg: India: gst+5:30 Nice work done!!!
18th Jun 2018, 1:00 PM
Sahil Danayak
Sahil Danayak - avatar
+ 3
Fixed wrong Output by using localtime() instead of gmtime(). Works fine in Pydroid. Here on SL I add two hours (7200 Seconds).
19th Jun 2018, 6:58 PM
Sebastian Keßler
Sebastian Keßler - avatar
+ 1
it is funny. now for me it shows ,25:05 o'clock of yesterday :)
18th Jun 2018, 11:07 PM
yuri