Commit Graph

1 Commits

Author SHA1 Message Date
Hideki Saito
8b5bba6fa1 Merge pull request #626 from pablomh/datetime_format (#732)
plugins/callback/profile_tasks.py: Add option to provide a different date/time format

SUMMARY
The new datetime_format key will offer the possibility of providing a different date/time format than the default one ('%A %d %B %Y  %H:%M:%S %z').

The iso8601 value can be used as an '%Y-%m-%dT%H:%M:%S.%f' alias (format of the ISO 8601 date/time standard).

The code has changed from using the time API to the datetime one in order to support sub-second precision (needed by the ISO 8601 format, for example).
Fixes: #279
ISSUE TYPE

Feature Pull Request

COMPONENT NAME
plugins/callback/profile_tasks.py
ADDITIONAL INFORMATION

Output with no key which keeps current behavior:

TASK [Import subscription manifest] *******************************************************************************************************************************************************************************************************************************************************************
Thursday 10 April 2025  00:52:11 +0200 (0:00:17.416)       0:00:17.453 ********
changed: [localhost]

Output with datetime_format = 'iso8601':

TASK [Import subscription manifest] *******************************************************************************************************************************************************************************************************************************************************************
2025-04-10T00:55:19.967718 (0:00:15.664)       0:00:15.691 ********************
changed: [localhost]

Output with datetime_format = '%Y-%m-%dT%H:%M:%S.%f%z' (ISO 8601 with UTC offset information):

TASK [Import subscription manifest] *******************************************************************************************************************************************************************************************************************************************************************
2025-04-10T00:57:49.290347+0200 (0:00:16.265)       0:00:16.293 ***************
changed: [localhost]

Reviewed-by: Hideki Saito <saito@fgrep.org>
(cherry picked from commit 1994b2cf1c)

Co-authored-by: softwarefactory-project-zuul[bot] <33884098+softwarefactory-project-zuul[bot]@users.noreply.github.com>
2026-05-18 10:43:04 +09:00