Why does utime.gmtime() exist?

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
kwiley
Posts: 140
Joined: Wed May 16, 2018 5:53 pm
Contact:

Why does utime.gmtime() exist?

Post by kwiley » Fri Apr 09, 2021 1:38 pm

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.

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Why does utime.gmtime() exist?

Post by dhylands » Fri Apr 09, 2021 9:14 pm

In the unix version of MicroPython localtime and gmtime don't return the same results.

kwiley
Posts: 140
Joined: Wed May 16, 2018 5:53 pm
Contact:

Re: Why does utime.gmtime() exist?

Post by kwiley » Fri Apr 09, 2021 11:49 pm

Oh! I had no idea. Thanks.

Post Reply