diff options
author | Damien George <damien@micropython.org> | 2020-08-31 14:55:54 +1000 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2020-09-01 12:36:28 +1000 |
commit | 2a72e90ab8969b69304d84aa7070720d63c60d06 (patch) | |
tree | 93a48c852416f8797e688cc85b2afdf63295f056 /extmod/vfs_fat.c | |
parent | 0385b21597a3e5dc3d1a84cd37848fc2ac2a0e20 (diff) |
extmod/vfs: Add option to use 1970 as Epoch.
By setting MICROPY_EPOCH_IS_1970 a port can opt to use 1970/1/1 as the
Epoch for timestamps returned by stat(). And this setting is enabled on
the unix and windows ports because that's what they use.
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'extmod/vfs_fat.c')
-rw-r--r-- | extmod/vfs_fat.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/extmod/vfs_fat.c b/extmod/vfs_fat.c index 79b0fc119..ace5ba5b6 100644 --- a/extmod/vfs_fat.c +++ b/extmod/vfs_fat.c @@ -319,6 +319,9 @@ STATIC mp_obj_t fat_vfs_stat(mp_obj_t vfs_in, mp_obj_t path_in) { (fno.ftime >> 5) & 0x3f, 2 * (fno.ftime & 0x1f) ); + #if MICROPY_EPOCH_IS_1970 + seconds += TIMEUTILS_SECONDS_1970_TO_2000; + #endif t->items[0] = MP_OBJ_NEW_SMALL_INT(mode); // st_mode t->items[1] = MP_OBJ_NEW_SMALL_INT(0); // st_ino t->items[2] = MP_OBJ_NEW_SMALL_INT(0); // st_dev |