Bug #3974
Invalid UTC times
Status: | Closed | Start date: | 01/11/2022 | |
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assigned To: | Knödlseder Jürgen | % Done: | 100% | |
Category: | - | |||
Target version: | 2.0.0 | |||
Duration: |
Description
The following code snippet produces an invalid UTC string
>>> import gammalib
>>> t=gammalib.GTime('JD 2436913')
>>> print t.utc()
1972-01--4404T11:59:18
Note that according to the method documentation the
GTime::utc()
method is only valid for dates from year 1972 on. This is probably at the origin of the feature. Some code could be implemented that corrects the date for negative seconds.
Recurrence
No recurrence.
Related issues
History
#1 Updated by Knödlseder Jürgen almost 3 years ago
- Related to Bug #3975: Correctly display UTC times before 1972 added
#2 Updated by Knödlseder Jürgen almost 3 years ago
- Status changed from New to Pull request
- Assigned To set to Knödlseder Jürgen
- Target version set to 2.0.0
- % Done changed from 0 to 90
I added the following code to GTime::utc
to cope with times before 1972:
while (day < 0) {
year--;
days = days_in_year(year);
day += days;
}
This gives now>>> import gammalib
>>> t=gammalib.GTime('JD 2436913')
>>> print t.utc()
1959-12-10T11:59:18
#3 Updated by Knödlseder Jürgen almost 3 years ago
- Status changed from Pull request to Closed
- % Done changed from 90 to 100
Merged into devel
.