On 12/31/2014 18:55, James Lynes wrote:
> Have you looked at Wx::DateTime::Now()?
>
> I looked in WxDemo and found:
>
> my $date = Wx::DateTime::Now();
> $date->FormatDate()
> $date->FormatTime()
>
> There are a lot of accessor methods listed in the wxWidgets docs.
Again, I have looked in the docs. Repeatedly. However, I might have
missed something in my frustration, so please do point out where there
is a GetTimeT() or equivalent. :)
There's a GetTicks() in the docs, but according to:
https://metacpan.org/source/MDOOTSON/Wx-0.9922/ext/datetime/XS/DateTime.xsp
it's not in the code anywhere that Perl can access it. Also according to:
http://www.nntp.perl.org/group/perl.wxperl.users/2013/06/msg9037.htm
...the API has changed from 2.8 to 2.9 and no one has made all the 2.9
methods work for the perl version of this object.
To make matters a bit worse, each time you GetValue() from a
DatePickerCtrl or TimePickerCtrl, it appears it gives you a brand new
Wx::DateTime object. So as far as I can tell, you have to do this:
use Wx::DateTime:
use Date::Parse;
...
my $dt = $some_date_widget->GetValue();
my $time_t_value = str2time($dt->FormatDate() . " " . $dt->FormatTime());
to get the time_t value you want. One now trusts in both Wx::DateTime
and Date::Parse to make sure there's no funny timezone business messing
with the value you want.
Please correct me if I'm missing something here. Thanks.
--
Dave Hayes - Consultant - Altadena CA, USA - d...@jetcafe.org
>>>> *The opinions expressed above are entirely my own* <<<<
"Obviously, the obvious is not obvious...."
--The Unknown Drummer