Skip to content

creation time is incorrect for files uploaded to the board #221

@dkonyshev

Description

@dkonyshev

Hello,

I tried to use rsync to upload updated files in rshell with my RPi Pico board and it didn't work for me. The problem is that my timezone is +6 to UTC and all files uploaded to the board get creation time in future. It seems that the problem occurs because rshell uses the current local time to set the current time on the board. As Micropython doesn't have any timezone information, the time is interpreted as UTC time.

For now I fixed this like follows but, perhaps, there's a better way?

$ git diff
diff --git a/rshell/main.py b/rshell/main.py
index 7a810d9..80526fb 100755
--- a/rshell/main.py
+++ b/rshell/main.py
@@ -1657,7 +1657,7 @@ class Device(object):

     def sync_time(self):
         """Sets the time on the pyboard to match the time on the host."""
-        now = time.localtime(time.time())
+        now = time.gmtime(time.time())
         self.remote(set_time, (now.tm_year, now.tm_mon, now.tm_mday, now.tm_wday + 1,
                                now.tm_hour, now.tm_min, now.tm_sec, 0))
         return now

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions