Skip to content

Commit

Permalink
Use a datetime object for file timestamps rather than float (#340)
Browse files Browse the repository at this point in the history
  • Loading branch information
d-j-hatton authored Sep 9, 2024
1 parent b0e44e9 commit 71da2e1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/murfey/instrument_server/api.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import secrets
import time
from datetime import datetime
from logging import getLogger
from pathlib import Path
from typing import Annotated, Dict, List, Optional, Union
Expand Down Expand Up @@ -220,7 +221,7 @@ def get_possible_gain_references() -> List[File]:
name=gf.name,
description="",
size=gf.stat().st_size / 1e6,
timestamp=gf.stat().st_mtime,
timestamp=datetime.fromtimestamp(gf.stat().st_mtime),
full_path=str(gf),
)
)
Expand Down
3 changes: 2 additions & 1 deletion src/murfey/util/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ class File(BaseModel):
name: str
description: str
size: int
timestamp: float
timestamp: datetime
full_path: str


class ConnectionFileParameters(BaseModel):
Expand Down

0 comments on commit 71da2e1

Please sign in to comment.