Skip to content

Commit

Permalink
bugfix/datetime (#11)
Browse files Browse the repository at this point in the history
API Compatibility
  • Loading branch information
Zeyi-Lin authored Jun 22, 2024
1 parent 1aeeaff commit bf7d5ed
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions swankit/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class SwanLabMode(Enum):
"""
swanlab的解析模式,枚举类
"""

DISABLED = "disabled"
CLOUD = "cloud"
# CLOUD_ONLY = "cloud-only"
Expand Down Expand Up @@ -77,9 +78,8 @@ def is_windows() -> bool:


def create_time() -> str:
"""获取当前时间(UTC时区)
"""
return datetime.datetime.now(datetime.UTC).isoformat()
"""获取当前时间(UTC时区)"""
return datetime.datetime.now(datetime.timezone.utc).isoformat()


def get_save_dir() -> str:
Expand Down
2 changes: 1 addition & 1 deletion test/unit/test_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def test_create_time():
t = E.create_time()
assert t.endswith("+00:00")
d = datetime.datetime.fromisoformat(t)
assert d.tzinfo == datetime.UTC
assert d.tzinfo == datetime.timezone.utc


class TestGetFolder:
Expand Down

0 comments on commit bf7d5ed

Please sign in to comment.