[wx-dev] wxDateTime 'invalid value'
Armel Asselin
asselin.armel at wanadoo.fr
Wed Jan 24 09:31:51 PST 2007
> AA> i'm currently trying to use wxDateTime to represent dates which are
> input
> AA> from scripts (which I test wrt to a somewhat standard test suite).
> AA> I'm confronted to this problem:
> AA> wxDateTime() { m_time = wxLongLong((long)ULONG_MAX, ULONG_MAX); }
> AA>
> AA> it seems that the "invalid" date is rather poorly chosen because this
> date
> AA> is also the date 1969/12/31 23:59:59.999 which is in the range of
> dates and
> AA> times handled by wxDateTime.
>
> Yes, there is indeed a problem here. I have no idea why did I choose such
> a bad default value. Thanks for noticing this!
>
> AA> could we use m_time = wxLongLong((long)(ULONG_MAX-(ULONG_MAX>>1)), 0)
> as
> AA> "invalid" value?
> AA> it is basically the largest negative value which can be coded on a
> AA> wxLongLong, and this value is indeed -not- in the range of dates
> handled by
> AA> wxDateTime.
>
> Wouldn't it be better to use wxLongLong(LONG_MAX, ULONG_MAX)?
why not, finally here I chose wxLongLong(LONG_MIN, 0) (which is the same
value as what I proposed before, written the right way!).
as you prefer.
Regards
Armel
More information about the wx-dev
mailing list