Skip to content

Commit

Permalink
Added additional FileOpenTime format
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanNoky committed Nov 14, 2024
1 parent 0e9934c commit 2fd0394
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/cpfs_ppms/schema_packages/schema_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -706,9 +706,17 @@ def normalize(self, archive, logger: BoundLogger) -> None: # noqa: PLR0912, PLR
' '.join(line.split(',')[2:4]), '%m-%d-%Y %I:%M %p'
)
except ValueError:
iso_date = datetime.strptime(
line.split(',')[3], '%Y-%m-%d %H:%M:%S'
)
try:
iso_date = datetime.strptime(
line.split(',')[3], '%Y-%m-%d %H:%M:%S'
)
except ValueError:
try:
iso_date = datetime.strptime(
line.split(',')[3], '%m/%d/%Y %I:%M:%S %p'
)
except ValueError:
logger.error('Could not read FILEOPENTIME')
setattr(self, 'datetime', iso_date)
if line.startswith('BYAPP'):
if hasattr(self, 'software'):
Expand Down

0 comments on commit 2fd0394

Please sign in to comment.