Skip to content

Commit e2988ee

Browse files
committed
add fdiff.utils module
1 parent 48fb8c6 commit e2988ee

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

lib/fdiff/utils.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import os
2+
3+
from datetime import datetime, timezone
4+
5+
6+
def get_file_modtime(path):
7+
"""Returns ISO formatted file modification time in local system timezone"""
8+
return (
9+
datetime.fromtimestamp(os.stat(path).st_mtime, timezone.utc)
10+
.astimezone()
11+
.isoformat()
12+
)
13+
14+
15+
def file_exists(path):
16+
"""Validates file path as existing local file"""
17+
return os.path.isfile(path)

0 commit comments

Comments
 (0)