Opened 17 years ago

Closed 13 years ago

#604 closed Bugs (wontfix)

from_ftime incorrectly processes FILETIME filled with zeros

Reported by: nobody Owned by: az_sw_dude
Milestone: Component: date_time
Version: None Severity: Showstopper
Keywords: Cc:

Description

using namespace boost::posix_time;
using namespace boost::gregorian;

FILETIME ft;
ZeroMemory( &ft, sizeof( ft ) );

ptime pt = from_ftime<ptime>( ft );

if ( pt.is_special() ) {
   // Never fall into this branch!
   std::cout << "ERROR";
} else {
   // Exception: boost::gregorian::bad_year
   std::cout << boost::format("%1%") % pt.date().year();
}

I suppose that when FILETIME is filled with zeroes,
from_ftime() should return not_a_date_time. But it does
not do this.

Change History (2)

comment:1 by quatras, 16 years ago

Logged In: YES 
user_id=994937

Note that a FILETIME of all binary zeros corresponds to the
time 1601-01-01 00:00:00.00000 GMT.  This is not really an
error, since it is a valid FILETIME, and is the beginning of
the FILETIME time-epoch.  MS defines a FILETIME as a
positive (non-negative) offset from that epoch, and only a
negative value is really an error.

comment:2 by Andrey Semashev, 13 years ago

Resolution: Nonewontfix
Severity: Showstopper
Status: assignedclosed

Zero FILETIME is valid, so there's no reason to convert it to not_a_date_time.

Note: See TracTickets for help on using tickets.