Skip to content

Commit 71da2e1

Browse files
authored
Use a datetime object for file timestamps rather than float (#340)
1 parent b0e44e9 commit 71da2e1

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/murfey/instrument_server/api.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import secrets
22
import time
3+
from datetime import datetime
34
from logging import getLogger
45
from pathlib import Path
56
from typing import Annotated, Dict, List, Optional, Union
@@ -220,7 +221,7 @@ def get_possible_gain_references() -> List[File]:
220221
name=gf.name,
221222
description="",
222223
size=gf.stat().st_size / 1e6,
223-
timestamp=gf.stat().st_mtime,
224+
timestamp=datetime.fromtimestamp(gf.stat().st_mtime),
224225
full_path=str(gf),
225226
)
226227
)

src/murfey/util/models.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ class File(BaseModel):
8585
name: str
8686
description: str
8787
size: int
88-
timestamp: float
88+
timestamp: datetime
89+
full_path: str
8990

9091

9192
class ConnectionFileParameters(BaseModel):

0 commit comments

Comments
 (0)