Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions sshfs/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import stat
import weakref
from contextlib import AsyncExitStack, suppress
from datetime import datetime
from datetime import datetime, timezone

import asyncssh
from asyncssh.sftp import SFTPOpUnsupported
Expand Down Expand Up @@ -34,6 +34,11 @@
_DEFAULT_MAX_SESSIONS = 10


def _naive_utc(timestamp):
# Naive UTC datetime, matching the historical utcfromtimestamp() output.
return datetime.fromtimestamp(timestamp, timezone.utc).replace(tzinfo=None)

Comment thread
shcheklein marked this conversation as resolved.
Outdated

class SSHFileSystem(AsyncFileSystem):
def __init__(
self,
Expand Down Expand Up @@ -151,8 +156,8 @@ def _decode_attributes(self, attributes):
"type": kind,
"gid": attributes.gid,
"uid": attributes.uid,
"time": datetime.utcfromtimestamp(attributes.atime),
"mtime": datetime.utcfromtimestamp(attributes.mtime),
"time": _naive_utc(attributes.atime),
"mtime": _naive_utc(attributes.mtime),
"permissions": attributes.permissions,
}

Expand Down
Loading