Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
engine
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AURA
engine
Commits
d2d00f48
Commit
d2d00f48
authored
1 year ago
by
David Trattnig
Browse files
Options
Downloads
Patches
Plain Diff
refactor: add timestamp utility
parent
45544fe3
No related branches found
No related tags found
1 merge request
!35
ORM-less scheduling
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/aura_engine/base/utils.py
+11
-2
11 additions, 2 deletions
src/aura_engine/base/utils.py
with
11 additions
and
2 deletions
src/aura_engine/base/utils.py
+
11
−
2
View file @
d2d00f48
...
...
@@ -34,14 +34,23 @@ class SimpleUtil:
"""
@staticmethod
def
to_datetime
(
datetime_str
:
str
):
def
string_
to_datetime
(
datetime_str
:
str
):
"""
Convert a
timezone aware
date-time string into `datetime`.
Convert a
ISO 8601
date-time string into `datetime`.
"""
if
datetime_str
:
return
datetime
.
datetime
.
fromisoformat
(
datetime_str
)
return
None
@staticmethod
def
timestamp_to_datetime
(
timestamp
:
float
):
"""
Convert a timestamp to datetime.
"""
if
timestamp
:
return
datetime
.
datetime
.
fromtimestamp
(
timestamp
)
return
None
@staticmethod
def
fmt_time
(
timestamp
:
int
):
"""
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment