Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pycalibration
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Model registry
Analyze
Contributor 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
calibration
pycalibration
Commits
96fe1275
Commit
96fe1275
authored
5 years ago
by
Karim Ahmed
Browse files
Options
Downloads
Patches
Plain Diff
get oldest file's timestamp
parent
07d41311
No related branches found
No related tags found
1 merge request
!115
feat/get_oldest_file's_timestamp
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cal_tools/cal_tools/tools.py
+9
-3
9 additions, 3 deletions
cal_tools/cal_tools/tools.py
with
9 additions
and
3 deletions
cal_tools/cal_tools/tools.py
+
9
−
3
View file @
96fe1275
...
@@ -425,7 +425,7 @@ def get_notebook_name():
...
@@ -425,7 +425,7 @@ def get_notebook_name():
return
environ
.
get
(
"
CAL_NOTEBOOK_NAME
"
,
"
Unknown Notebook
"
)
return
environ
.
get
(
"
CAL_NOTEBOOK_NAME
"
,
"
Unknown Notebook
"
)
def
get_dir_creation_date
(
directory
,
run
):
def
get_dir_creation_date
(
directory
,
run
,
tsdir
=
False
):
"""
"""
Return modification time of [directory]/[run]04
Return modification time of [directory]/[run]04
...
@@ -433,8 +433,14 @@ def get_dir_creation_date(directory, run):
...
@@ -433,8 +433,14 @@ def get_dir_creation_date(directory, run):
:param run: run number
:param run: run number
:return: (datetime) modification time
:return: (datetime) modification time
"""
"""
creation_time
=
stat
(
"
{}/r{:04d}
"
.
format
(
directory
,
run
)).
st_mtime
if
tsdir
:
creation_time
=
datetime
.
datetime
.
fromtimestamp
(
creation_time
)
creation_time
=
stat
(
"
{}/r{:04d}
"
.
format
(
directory
,
run
)).
st_mtime
else
:
rfiles
=
glob
(
"
{}/r{:04d}/*.h5
"
.
format
(
directory
,
run
))
rfiles
.
sort
(
key
=
path
.
getmtime
)
creation_time
=
stat
(
rfiles
[
0
]).
st_mtime
creation_time
=
datetime
.
datetime
.
fromtimestamp
(
creation_time
)
return
creation_time
return
creation_time
...
...
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