Start a Conversation

Unsolved

Y

1 Rookie

 • 

27 Posts

255

July 6th, 2022 13:00

DSU JSON output showing incorrect time

We are running dsu version 1.9.3.0, installed from the YUM repository, on RedHat 7 and RedHat 8.

We run it on a schedule with the command `dsu --output=/tmp/dsu.json --output-format=json --compliance` (and we run the json through jq and then use it for Puppet facts, but that doesn't affect this question).

The JSON appears to have a field showing the time the output was generated, but that time appears to be in 12-hour format with no AM or PM specification - when run at 4:30 PM (16:30) or 4:30 AM (04:30), it outputs 04:30 as the time. The time is accurately showing the time DSU was run other than not showing AM/PM/24-hour-format.

A screenshot showing the issue, taken at 16:30, not 04:30.

BARnVlW

 

Moderator

 • 

5.2K Posts

July 6th, 2022 23:00


Hi, hope the link helps: 
https://dell.to/3NPkwiH
It might be the OS's timezone. Can you run "date" CMD?

1 Rookie

 • 

27 Posts

July 7th, 2022 04:00

The `date` command shows the correct time in 24-hour format, so that is not the issue.

Moderator

 • 

2.8K Posts

July 7th, 2022 04:00

Hi, I'm not sure JSON date represent in which format. I found another thread discussed similar topic. Can you check here https://dell.to/3bV5PgO

1 Rookie

 • 

27 Posts

July 7th, 2022 05:00

That reenforces the issue - the format of the date/time that dsu is putting in the file does not match any standard format. I am guessing it is supposed to be using 24-hour time, but it is using 12-hour time and also not adding AM/PM.

 

I am guessing something in the code that does the time formating for the JSON output has a mistake - I don't think it is an issue with the operating system because we are seeing it on a number of different versions. I don't know what programming language dsu is written in, but for an example in c (other languages will be similar): the strftime() function takes the argument %H for 24-hour time and %I for 12-hour time. It is definitely not respecting the LOCALE time format on the computer - it seems to be hard coded this way.

No Events found!

Top