Page 1 of 1

Does uPython set ST_MTIME on file creation?

Posted: Fri May 11, 2018 9:31 pm
by tbnorth
My test below (uPython 1.9.x) suggests not, just wanted to confirm, thanks.

>>> rtc.datetime()
(2018, 5, 11, 4, 21, 10, 39, 146)
>>> open('delme2.del', 'w')
<io.TextIOWrapper 2000e100>
>>> rtc.datetime((2010, 5, 11, 4, 21, 10, 39, 146))
>>> open('delme3.del', 'w')
<io.TextIOWrapper 2000e270>
>>> rtc.datetime()
(2010, 5, 11, 4, 21, 10, 48, 20)
>>> os.stat('delme2.del')
(32768, 0, 0, 0, 0, 0, 0, 12873600, 12873600, 12873600)
>>> os.stat('delme3.del')
(32768, 0, 0, 0, 0, 0, 0, 12873600, 12873600, 12873600)

Re: Does uPython set ST_MTIME on file creation?

Posted: Mon May 14, 2018 5:02 pm
by dhylands
Which board are you using?

The timestamps seem to be modified on a pyboard:

Code: Select all

MicroPython v1.9.3-521-gd6cf5c6 on 2018-04-23; PYBv1.1 with STM32F405RG
Type "help()" for more information.
>>> rtc = pyb.RTC()
>>> rtc.datetime()
(2018, 5, 14, 1, 9, 57, 30, 200)
>>> open('delme2.del', 'w')
<io.TextIOWrapper 20003380>
>>> rtc.datetime((2010, 5, 11, 4, 21, 10, 39, 146))
>>> open('delme3.del', 'w')
<io.TextIOWrapper 20003a20>
>>> rtc.datetime()
(2010, 5, 11, 4, 21, 10, 54, 202)
>>> import os
>>> os.stat('delme2.del')
(32768, 0, 0, 0, 0, 0, 0, 579607056, 579607056, 579607056)
>>> os.stat('delme3.del')
(32768, 0, 0, 0, 0, 0, 0, 326927444, 326927444, 326927444)
>>> 

Re: Does uPython set ST_MTIME on file creation?

Posted: Mon May 14, 2018 9:34 pm
by tbnorth
Odd, I'm using PyBoard 1.1, will try again copy pasting your code and report versions more carefully. Thanks.