Ticket #763 (closed defect: fixed)

Opened 10 years ago

Last modified 10 years ago

DateTime timeval() returns incorrect micorsecs

Reported by: RayPlante Owned by: ktl
Priority: normal Milestone:
Component: daf_base Keywords:
Cc: srp Blocked By:
Blocking: Project: LSST
Version Number:
How to repeat:

not applicable

Description

The DateTime::timeval() is returning an incorrect timeval structure: in particular, the tv_usec will usually be greater than 1000000 (1 second). This is apparently due to an error in the conversion from nanoseconds:

    tv.tv_sec = static_cast<time_t>(nsecs / 1000000000LL);
    tv.tv_usec = static_cast<int>((nsecs % 10000000000LL) / 1000);

The microsecond calculation has one too many zeros in the LL-constant; it should be:

    tv.tv_sec = static_cast<time_t>(nsecs / 1000000000LL);
    tv.tv_usec = static_cast<int>((nsecs % 1000000000LL) / 1000);

This results in incorrect formatted forms of the DATE property in log records.

Change History

comment:1 Changed 10 years ago by ktl

  • Status changed from new to assigned
  • Component changed from unknown to daf_base

comment:2 Changed 10 years ago by ktl

  • Status changed from assigned to closed
  • Resolution set to fixed

Fixed directly on trunk (with test cases) in [9222].

comment:3 Changed 10 years ago by RayPlante

Excellent! Can you cut me a new daf_base release at you earliest convenience?

Note: See TracTickets for help on using tickets.