Page 1 of 1

Why does utime.gmtime() exist?

Posted: Fri Apr 09, 2021 1:38 pm
by kwiley
I realize utime is a MicroPython conversion of time and that time offers a gmtime() function, but given that time is specially tailored to MicroPython and that MicroPython doesn't offer built-in timezone calculations anyway, and given that gmtime() returns the same value of localtime(), why is gmtime() even in the language? I realize it might be a placeholder for future work, but that reasoning would seem to go against the ethos of minimizing MicroPython in any given era. Why not wait until (and if) timezone support is added at some unknown future point before adding the couple of bytes of wasted space taken up by an otherwise redundant gmtime() function?

I'm not asking sarcastically. I'm asking if time.gmtime() actually serves some practical purpose I'm unaware of. Is there a way in which it can be meaningfully utilized at present?

Thanks.

Re: Why does utime.gmtime() exist?

Posted: Fri Apr 09, 2021 9:14 pm
by dhylands
In the unix version of MicroPython localtime and gmtime don't return the same results.

Re: Why does utime.gmtime() exist?

Posted: Fri Apr 09, 2021 11:49 pm
by kwiley
Oh! I had no idea. Thanks.