File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 7
7
from pathlib import Path
8
8
import re
9
9
10
- CORRECTION = timedelta (10 , 60496 )
11
-
10
+ # CORRECTION = timedelta(10, 60496)
11
+ CORRECTION = timedelta ( seconds = ( 1535393272 - 1529482132 )) # epoch from good - raspi
12
12
TIMESTAMP_RE = r'(\d{4})-(\d{2})-(\d{2})-?T?(\d{2})[-.](\d{2})[-.](\d{2})'
13
13
14
- for path in sorted (Path .cwd ().glob ('*_2017-04-1*' )):
14
+ #for path in sorted(Path.cwd().glob('*_2018-06-20-*')):
15
+ for path in sorted (Path .cwd ().glob ('*_triangle*' )):
15
16
print ('--' )
16
17
print (path .name )
17
18
m = re .search (TIMESTAMP_RE , path .name )
18
19
old_ts = datetime (* [int (g ) for g in m .groups ()])
19
20
new_ts = old_ts + CORRECTION
20
- new_name = path .name [:m .start ()] + new_ts .strftime ("%Y-%m-%dT%H.%M.%S" ) \
21
+ if "T" in path .name :
22
+ new_name = path .name [:m .start ()] + new_ts .strftime ("%Y-%m-%dT%H.%M.%S" ) \
23
+ + path .name [m .end ():]
24
+ else :
25
+ new_name = path .name [:m .start ()] + new_ts .strftime ("%Y-%m-%d-%H-%M-%S" ) \
21
26
+ path .name [m .end ():]
22
27
print (new_name )
23
28
new_file = path .parent / new_name
You can’t perform that action at this time.
0 commit comments