summaryrefslogtreecommitdiff
path: root/extmod
diff options
context:
space:
mode:
authorNoralf Trønnes <noralf@tronnes.org>2018-08-25 18:11:10 +0200
committerNoralf Trønnes <noralf@tronnes.org>2018-08-25 20:43:02 +0200
commit39ee12d1ac6ffb105f6ac0994f6169a7bb327cbd (patch)
treee380f4c5259194f9dcf56c9c0618051d1fa97317 /extmod
parentd1b588375be0812f6e8d58f1eba1a6c82f91a931 (diff)
Fix os.stat() to use 1970 epoch
Commit 95e70cd0ea6d 'time: Use 1970 epoch' changed epoch for the time module, but not for other users. This patch does the same for the only other core timeutils user: extmod/vfs_fat.c:fat_vfs_stat(). Other timeutils users: cc3200, esp8266 and stm32, are not changed. Ports that don't use long ints, will still get wrong time values from os.stat().
Diffstat (limited to 'extmod')
-rw-r--r--extmod/vfs_fat.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/extmod/vfs_fat.c b/extmod/vfs_fat.c
index e2982c719..945ba9e80 100644
--- a/extmod/vfs_fat.c
+++ b/extmod/vfs_fat.c
@@ -320,7 +320,7 @@ STATIC mp_obj_t fat_vfs_stat(mp_obj_t vfs_in, mp_obj_t path_in) {
} else {
mode |= MP_S_IFREG;
}
- mp_int_t seconds = timeutils_seconds_since_2000(
+ mp_uint_t seconds = timeutils_seconds_since_epoch(
1980 + ((fno.fdate >> 9) & 0x7f),
(fno.fdate >> 5) & 0x0f,
fno.fdate & 0x1f,
@@ -335,9 +335,9 @@ STATIC mp_obj_t fat_vfs_stat(mp_obj_t vfs_in, mp_obj_t path_in) {
t->items[4] = MP_OBJ_NEW_SMALL_INT(0); // st_uid
t->items[5] = MP_OBJ_NEW_SMALL_INT(0); // st_gid
t->items[6] = mp_obj_new_int_from_uint(fno.fsize); // st_size
- t->items[7] = MP_OBJ_NEW_SMALL_INT(seconds); // st_atime
- t->items[8] = MP_OBJ_NEW_SMALL_INT(seconds); // st_mtime
- t->items[9] = MP_OBJ_NEW_SMALL_INT(seconds); // st_ctime
+ t->items[7] = mp_obj_new_int_from_uint(seconds); // st_atime
+ t->items[8] = mp_obj_new_int_from_uint(seconds); // st_mtime
+ t->items[9] = mp_obj_new_int_from_uint(seconds); // st_ctime
return MP_OBJ_FROM_PTR(t);
}