Skip to content

Commit b95f67b

Browse files
committed
ENH: Adjust to reflect it is microseconds that are parsed/reported
Made it also .000000 just for the sake of making robust since %f expects microseconds
1 parent 09a9ea2 commit b95f67b

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

heudiconv/utils.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ def get_typed_attr(obj, attr, _type, default=None):
510510

511511
def get_datetime(date, time):
512512
"""
513-
Convert date and time from dicom to isoformat.
513+
Combine date and time from dicom to isoformat.
514514
515515
Parameters
516516
----------
@@ -522,11 +522,12 @@ def get_datetime(date, time):
522522
Returns
523523
-------
524524
datetime_str : str
525-
Combined date and time in ISO format, with milliseconds.
525+
Combined date and time in ISO format (with microseconds if
526+
they were available in provided time).
526527
"""
527528
if '.' not in time:
528-
# add milliseconds if not available
529-
time += '.000'
529+
# add dummy microseconds if not available for strptime to parse
530+
time += '.000000'
530531
td = time + ':' + date
531532
datetime_str = datetime.strptime(td, '%H%M%S.%f:%Y%m%d').isoformat()
532533
return datetime_str

0 commit comments

Comments
 (0)