Skip to content

python-aodntools: Incorrect use of datetime.utcnow() #125

@mhidas

Description

@mhidas

Acceptance criteria

  1. All uses of datetime.utcnow() have been replaced with datetime.now(timezone.utc)

Notes

  • datetime.utcnow() is currently used to set the creation date (global attribute and in file names) in all timeseries_products code, and in ncwriter/imos_template.py
  • This function can potentially return the system's local time as if it was UTC (see warning in datetime docs, or in more detail in this blog). This will lead to at most an 11-hour offset, which is not a huge problem, but it would be easy to fix.
  • From datetime docs:

the recommended way to create an object representing the current time in UTC is by calling datetime.now(timezone.utc)

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingncwriterRelated to creating netCDF files based on templates

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions