What if you implemented it as 'spin' or 'hour' or 'spin_hour' or
whatever, as a number and (optionally) exported constants to signify the
algorithm? That means users could either provide their own number, or
could use one of the provided.
I don't write much perl any more so forgive me if I
On 3/07/2017 17:44, Binarus wrote:
This answer has 49 upvotes, so can't be too wrong.
Oh no, this is the internet.
That's likely 49 other people don't know the answer, but want to look
smart.
- Rick
--
Message protected for iSite by MailGuard: e-mail anti-virus, anti-spam and
content
I'm not sure what you mean by 'local DIE handlers'. Are you talking
about defining a local $SIG{__DIE__} ?
I've been out of perl for a couple of years, but surely you should just
use eval{} ?
$dt = eval { $parser->parse( $input );};
if( $@ ){
echo "Unable to parse your date
> I don't understand [why] it is not already in the DateTime module
Because it doesn't make a lot of sense. GMT+6 doesn't allow for daylight
savings changes and any other historic changes. it requires your users
to come to the site twice a year to adjust their time zone.
Instead you should
On 16-Jan-15 07:53, Jean Forget wrote:
I have noticed that your module has not been updated till 2004.
Hi everyone! Happy DateTime-now() to you all.
As Jean pointed out above, I have not done much on DateTime in quite a
while. I don't play much in perl any more, but remain proud of the work
Hi Jean,
Thanks for poking me on this. I don't spend much time coding any more.
And even less, coding in perl. And even less coding in DateTime!
If you're willing to take over the maintenance then I have no problem
with that at all. You'll need to remind me what I need to do to make
that
First note is that Strptime is designed to be flexible. Speed wasn't the goal.
That said, it also wasn't designed to be slow!
Second, and most importantly, your benchmark should fare MUCH better if you
don't create a new parser every time. Create the parser outside the benchmark
sub and it
Hi Andreas,
It does need to be documented, but to explain:
$dt-compare follows the behavior of `cmp` and ``.
- Rick
On Thu, 10
Oct 2013 10:07:02 +0200, Andreas Isberg wrote:
Hi,
The
documentation does not specify what What does
DateTime::Duration-compare() returns.
From some
Back in 2007 I wrote about some code I wrote in 2003. No idea if it'd be
useful.
http://grokbase.com/t/perl/datetime/073612z62x/event-dst-pulling-dst-changes-from-datetime
Cheers!
Rick Measham
On 23/05/2012, at 6:59, Anthony Ball a...@suave.net wrote:
I never had any luck finding anything
epoch days, you'd see a double up every ~4 years so that years were always a
multiple of 365. (Imagine if leap seconds actually skewed the epoch by a second
how hard it would be to use them? (eg: time() % 86400))
Cheers!
Rick Measham
On 25/05/2012, at 23:08, Anthony Ball a...@suave.net wrote:
So
Magic!
Cheers!
Rick Measham
On 09/05/2012, at 6:38, mer...@stonehenge.com (Randal L. Schwartz) wrote:
Rick == Rick Measham r...@measham.id.au writes:
Rick $ olson time 13:48 # where is it currently 13:44?
Rick $ olson time 13:48 -Cau # where in Australia is it currently 13
it against any recent DateTime releases.
Cheers!
Rick Measham
On 02/05/2012, at 8:29, Philipp K. Janert jan...@ieee.org wrote:
Question:
When using DateTime for a large number of
instances, it becomes a serious performance
drag.
A typical application for me involves things like
log
/Sydney
Feels like a useful way to offer a limited number of zones to a customer
when you know their localtime (eg. in a web interface)
Cheers!
Rick Measham
On 6/03/2012 9:21 AM, Zefram wrote:
New version of the query tool attached. This one has a lot more options
for searching for zones. It lets
lies in its accuracy, and an important part of that is
validation.
If you want to add a day, add a day. It works as you'd expect.
Cheers!
Rick Measham
* Possibly not.
Imagine we're operating a dam and in order to be well prepared we issue a new
command every day: in one years time, spill
= 13, day = 42 ) assume you wanted Dec 31?
No, it's an error.
If you wanted 13 months, 42 days after Jan 1st 2012, then you should be using
date math.
Cheers!
Rick Measham
On 03/03/2012, at 5:14, Karen Etheridge p...@froods.org wrote:
On Thu, Mar 01, 2012 at 08:26:13PM -0800, Michael G
at
the top of the synopsis?
Cheers!
Rick Measham
--
Message protected for iSite by MailGuard: e-mail anti-virus, anti-spam and
content filtering.http://www.mailguard.com.au
provide
an easy route to ::incomplete for other parsers that already use
strptime for parsing.
Cheers!
Rick Measham
On 29/03/2011 9:37 AM, Karen Etheridge wrote:
I just started using DateTime::Incomplete for a project and discovered that
would be handy to have a string parser, so I came back
' option.
No solutions, just thoughts.
Cheers!
Rick Measham
On 24/02/2011, at 17:59, Philip Kime philk...@kime.org.uk wrote:
Yes, that would be fine and I could use DateTime::Incomplete to get
what I want but unfortunately what I need is the parsing so I don't
have to parse it all myself (which
This works in my head:
$dt-add( seconds = 30 )-truncate( to = 'minute' );
Cheers!
Rick Measham
On 01/12/2010, at 10:32 PM, Jaldhar H. Vyas jald...@braincells.com wrote:
Is there a simple way to do this (i.e. 6:14:56 becomes 6:15:00, 6:14:07
becomes 6:14::00 etc.) or do I have to roll my own
::Duration which is aimed at formatting durations in a
manner that makes sense to the user of the module.
Cheers!
Rick Measham
On 16/07/2010 12:15 PM, Paul Miller wrote:
On Thu, Jul 15, 2010 at 5:42 PM, Rick Meashamr...@measham.id.au wrote:
You'd be looking for the ISO normalization in DateTime
, got frustrated, wandered
off and gave up. Sorry I can't offer you any further help, but the
inability is so fundamental to the way spans and spansets are built that
there would be no solution beyond created your own set of classes.
Cheers!
Rick Measham
--
Message protected for iSite
!
Rick Measham
--
Message protected for iSite by MailGuard: e-mail anti-virus, anti-spam and
content filtering.http://www.mailguard.com.au
Dave Rolsky wrote:
On Tue, 14 Jul 2009, Rick Measham wrote:
This release depends on DateTime::Locale 0.43 and the locale tests
expect the data provided by that module. This isn't future-proof, but
Dave says that the methods that provide the %x, %X and %c patterns to
strftime are deprecated
patterns for %c, %x
and %X? If not, how will those be generated?
Cheers!
Rick Measham
--
Message protected for iSite by MailGuard: e-mail anti-virus, anti-spam and
content filtering.
http://www.mailguard.com.au
Code:
http://datetime-format-strptime.googlecode.com/files/DateTime-Format-Strptime-1.1000.tgz
Cheers!
Rick Measham
--
Message protected for iSite by MailGuard: e-mail anti-virus, anti-spam and
content filtering.
http://www.mailguard.com.au
.. it uses it to fill in the blanks, but
your module shouldn't need that.
Cheers!
Rick Measham
--
Message protected for iSite by MailGuard: e-mail anti-virus, anti-spam and
content filtering.
http://www.mailguard.com.au
, but I'm guessing %G got added to
DateTime's strftime function after I created strptime.
While I can add support for %G, it's a bit of a PITA and I doubt it's
ever actually needed. %Y is the correct symbol for the format you're using.
Cheers!
Rick Measham
--
Message protected for iSite
-04-08 23:22:00' AND colname '2009-04-09 23:22:00')
OR (colname = '2009-05-08 23:22:00' AND colname '2009-05-09 23:22:00')
(Of course, this couldn't be expected to work on infinite or even large
spansets)
Just my $0.02.
Cheers!
Rick Measham
--
Message protected for iSite by MailGuard: e
haven't seen notifications from there either and
there are four issues listed.]
Once again, thanks for the heads-up. I'll get a release out ASAP.
(Whoever runs search.cpan .. is there any way you
Cheers!
Rick Measham
smime.p7s
Description: S/MIME Cryptographic Signature
installed?
DBD::Pg
DateTime::Format::Pg
Cheers!
Rick Measham
smime.p7s
Description: S/MIME Cryptographic Signature
with a button to
'show all time zones'.
Cheers!
Rick Measham
--
Message protected for iSite by MailGuard: e-mail anti-virus, anti-spam and
content filtering.
http://www.mailguard.com.au
to be a nice fit between my DateTime::Lazy and
full-blown DateTime. To that end, it would be nice if there was a
-to_datetime method that returned the same datetime as a DateTime object.
Cheers!
Rick Measham
--
Message protected for iSite by MailGuard: e-mail anti-virus, anti-spam and
content
something like
DateTime::Format::Duration::Locale that makes use of the data.
The normalisation functions in DateTime::Format::Duration give it its
real power so I would suggest you wrap the _as_deltas methods in
whatever you decide to do.
Cheers!
Rick Measham
--
Message protected for iSite
P DD wrote:
my $tom = ($now + DateTime::Duration-new(days = 1))-truncate(to =
'day');
Can I suggest this for neater code:
my $tom = $dt-clone-add( days = 1 )-truncate( to = 'day' );
Cheers!
Rick Measham
--
Message protected for iSite by MailGuard: e-mail anti-virus, anti-spam and
content
Dave Rolsky wrote:
However, it will break DateTime::Format::Strptime, apparently.
Paging Rick Measham ;)
Thanks for the work with Locales Dave, great to get all the available
data in there.
I'll look at strptime in the next couple of days unless someone submits
a patch earlier :-D
: I'm happy to hand this module over to you if you want to put
it on CPAN and maintain it, otherwise I will.
Cheers!
Rick Measham
--
Message protected for iSite by MailGuard: e-mail anti-virus, anti-spam and
content filtering.
http://www.mailguard.com.au
DayOfWeek.pm
Description: Perl
Dave Rolsky wrote:
Iraq
Oh, finally some good news from Iraq! They've abandoned DST!
Cheers!
Rick Measham
--
Message protected for iSite by MailGuard: e-mail anti-virus, anti-spam and
content filtering.
http://www.mailguard.com.au
to keep reassuring us!
Cheers!
Rick Measham
--
Message protected for iSite by MailGuard: e-mail anti-virus, anti-spam and
content filtering.
http://www.mailguard.com.au
change
(3) historically un-mappable to any 'proper' time zone as they
keep changing by civil decree in various jurisdictions
Cheers!
Rick Measham
--
Message protected for iSite by MailGuard: e-mail anti-virus, anti-spam and
content filtering.
http://www.mailguard.com.au
William Heath wrote:
The
trouble is I need to find the GMT offset for a timezone and I don't
know how to do this correctly for daylight saving time.
my $dt = new DateTime(
year = 2008,
month = 3,
day = 12,
hour = 16,
time_zone = 'Australia/Melbourne'
to calculate them?
http://en.wikipedia.org/wiki/Season#Reckoning seems to have the
information you need.
Cheers!
Rick Measham
smime.p7s
Description: S/MIME Cryptographic Signature
, you end up with it
dieing on day 9)
Cheers!
Rick Measham
business_days.pl
Description: Perl program
smime.p7s
Description: S/MIME Cryptographic Signature
:: or Time:: or TimeDate:: ?
Cheers!
Rick Measham
http://www.wral.com/news/local/story/2011296/
Thought my fellow datetime nerds would get a laugh out of this story.
Cheers!
Rick Measham
smime.p7s
Description: S/MIME Cryptographic Signature
Dave Rolsky wrote:
I see it's use, but it's really easy to do already:
$dt-truncate( to = 'week' )-subtract( days = 1 );
Ahh crap!
All it takes is another set of eyes. My code to do it belongs on the
daily-wtf!
Cheers!
Rick Measham
smime.p7s
Description: S/MIME Cryptographic Signature
to it! Thanks Zefram, that
fixes the problem I had with the task originally.
Cheers!
Rick Measham
smime.p7s
Description: S/MIME Cryptographic Signature
Is there any chance we can have -truncate( to = 'Sunday' ) for
truncating to week-beginning-on-sunday?
Cheers!
Rick Measham
smime.p7s
Description: S/MIME Cryptographic Signature
. Did
something change in the latest Locale release that affects the French
information? (Possibly other stuff too, I just test the French)
Cheers!
Rick Measham
smime.p7s
Description: S/MIME Cryptographic Signature
::Strptime'.
# Error: Can't locate DateTime/Helpers.pm in @INC (@INC contains:
Erm .. WTF is DateTime::Helpers?
.. and what does it have to do with DateTime::Format::Strptime?
Cheers!
Rick Measham
smime.p7s
Description: S/MIME Cryptographic Signature
'],
Should be:
['-00-00 48:00:00', '-00-01 24:00:00', 'DST ends, Day is 25
hours long'],
However going the rest I don't agree that it's just a case of fixing the
tests and so I've refactored the code.
Look for 1.03 on a CPAN mirror near you shortly.
Cheers!
Rick Measham
smime.p7s
on how we can do such things.
Cheers!
Rick Measham
wants to resurrect it. No idea how
it worked or if it still works.
Cheers!
Rick Measham
the ability to load other
TZ modules from a string. Eg. time_zone = LMT/46d43m27s would look
for LMT/46d43m27s.pm and failing that, drop back to looking for LMT.pm
and pass it's constructor the '46d43m27s'.
Cheers!
Rick Measham
Zefram wrote:
Rick Measham wrote:
my $riyadh_lmt = DateTime::TimeZone::LMT-new(
longitude = 46 + (43 / 60) + (27 / 3600)
);
How much error in time conversions is introduced by the floating point
rounding?
DateTime allows for a one-second precision in the offset, so while LMT
passes
-from_epoch(
epoch = $eventDate,
# So that DST is accounted for:
time_zone = 'Australia/Melbourne',
);
$dt-add( weeks = 1 );
$dt-epoch ==
(1 week after the $eventDate expressed as an epoch)
Cheers!
Rick Measham
!
Rick Measham
.0.54
Just a thought .. not really too important
Cheers!
Rick Measham
this through time2str,
and got an inconsistent day-of-week: Thu Aug 3 03:45:00 GMT 2006
What have I missed??? Do I have fighting use-statements?
You have bad input data. My calendar shows that August 3rd, 2006 was a
Thursday, not a Monday.
Cheers!
Rick Measham
Eugene van der Pijll wrote:
We should not perhaps be calling our time scale
utc; but that would again be hard to explain to ordinary users.
I'm still trying to convince people that you can't just add 24*60*60 to
time() to add a day ..
Cheers!
Rick Measham
Zefram wrote:
Rick Measham wrote:
I'm still trying to convince people that you can't just add 24*60*60 to
time() to add a day ..
That's one of the things you *can* do, unless you're starting in a leap
second (in which case time() is ambiguous). time() increases exactly
86400 per UTC day
Mike Schilli wrote:
Maybe %H matched a 24-hour value in the AM range, which conflicts
with the %p value found (PM). Use %I for 12-hour values. would be
easier to understand for the impatient reader :).
Sure .. I can do that .. though it won't specify %H .. more like: The
hour value is in
is in the
morning. To hand it to you on a platter, you're using the %H specifier
in your pattern which is the 24-hour specifier rather than %I which is
the 12 hour specifier.
Cheers!
Rick Measham
--
Message protected by MailGuard: e-mail anti-virus, anti-spam and content
filtering.
http
at all and I've not
written any tests. I've attached it in case it helps.
Cheers!
Rick Measham
package DateTime::Format::TimeParseDate;
use strict;
use warnings;
use DateTime;
use Time::ParseDate qw//;
use Params::Validate qw/validate BOOLEAN/;
sub parse_datetime {
my $class = shift;
my $date
discussion. If you need it,
consider writing DateTime::Format::Overflow or similar.
Cheers!
Rick Measham
Sorry this has taken so long to release .. kinda forgot it was sitting
there...
There's a few doc errors (errors I missed last time too ..) including
spelling Philip's name completely wrong. Sorry mate! I'll fix these
errors in a new release later this week that, unless anyone finds other
? If you're only using some of them, have a
look at DateTime::LazyInit (which reminds me, I need to release the new
version huh?)
Cheers!
Rick Measham
-as-I-need-it in DT:F:D as I'm
losing too much hair over this!
Cheers!
Rick Measham
the
overloads, or create full DateTime objects.
Cheers!
Rick Measham
it will also allow you to add a Class name to inflate() so that
you can use your subclassing ..
print ref $dtLI;
# DateTime::LazyInit;
$dtLI-inflate('yourClass');
print ref $dtLI;
# yourClass
Cheers!
Rick Measham
P.S. if you want to run benchmarking on the overloading, and it shows
that it doesn't
Dave and the rest of the DateTime team want to chime in, I'd just
suggest you overload the whole __inflate() routine.
Cheers!
Rick Measham
that looks like it will
fit within the goals of LI, I'll have a look.
Cheers!
Rick Measham
around that would help you
divide the state into positive regions
(http://www.zipinfo.com/search/zipcode.htm). After that you can hand-cut
those along the edges of those regions.
Just a few thoughts
Cheers!
Rick Measham
--
War is God's way of teaching Americans geography
around N degrees longitude so everything 100
miles to the west of the line gets America/AnotherCity and everything
100 miles to the east gets America/SomeCity. That leaves you with a 200
mile section that you'd need to sort for yourself.
Of course, it's never that easy is it?
Cheers!
Rick
moved it later and changed back on the last Sunday
in March
In 2006 and only 2005, we're moving back on the Sunday that is
greater-or-equal to the first of April
Then from 2007 onwards we're back to the last Sunday in March
Cheers!
Rick Measham
[1] ftp://elsie.nci.nih.gov/pub
which we know changes. Most people I talk to here would prefer
it to be 'Permanent Daylight Savings' we Melbourne would be UTC+1100
every day of the year.
/rant
Cheers!
Rick Measham
--
War is God's way of teaching Americans geography.
-- Ambrose Bierce
::Format::ISO8601 rather than Strptime
Cheers!
Rick Measham
--
War is God's way of teaching Americans geography.
-- Ambrose Bierce
to.
(Personally, I'd be happy as a user if I asked for 90m if it returned
1h30m .. but I imagine different things need different units)
Cheers!
Rick Measham
that to determine if both durations are *always* equal (so maybe we need
to add a comparison function for it:
1 second === 10 nanoseconds
1 year === 12 months
N units === N units
I'm happy to work on a patch if people want to see this functionality?
Cheers!
Rick Measham
:
my $date1 = DateTime-new( %{ yourFunction() } );
my $date2 = DateTime-new( myFunction() );
Cheers!
Rick Measham
* If it doesn't do everything you need, then let the datetime list know
so we can consider it!
--
War is God's way of teaching Americans geography
On Wed, 21 Dec 2005, Rick Measham wrote:
my $DateTimeGPS = DateTime::Decorated( with = 'GPS' );
Dave Rolsky wrote:
This means you're sticking a Decorated() function into the DateTime
namespace. Is that intentional? It seems awfully weird.
Oops! My bad ..
my $DateTimeGPS = new DateTime
= 2005, week = 48 );
AND COMBINING TOO
my $DateTime2 = DateTime::Decorated(with = ['GPS', 'WeekConstructor']);
my $dt = $DateTime2-from_week( year = 2005, week = 48 );
print join('G', $dt-gps_week, $dt-gps_second);
__END__
Cheers!
Rick Measham
--
War is God's way of teaching Americans geography
wanted
to add to it, but (IIRC) that will mean checking out the cvs and
submitting a patch.
It's a pity to lose the tests though ..
Cheers!
Rick Measham
Why does time() return a multiple of 60? Surely each time there's a leap
second time()%60 should increment?
Cheers!
Rick Measham
of
elapsed seconds since 1970 ...
Cheers!
Rick Measham
the Wiki :)
Thanks heaps for all this work, though I can see that my job comes next
and it will be a doozy.
Cheers!
Rick Measham
for additions/subtractions.
I've CC'd this to the main list ...
Dave, what's the status on DateTime math? Should I fix DT:F:D to work
with the current DateTime, or are you likely to find the tuits you need
sometime soon?
Cheers!
Rick Measham
can't (yet) put an Olson time zone ID in the string. Only in
the constructor.
Cheers!
Rick Measham
with another bug-fix
(also TZ related)
Cheers!
Rick Measham
This will be hitting your local CPAN mirror shortly. (yes I know I
misspelled twilight .. but it's not worth a patch!)
Cheers!
Rick Measham
1.0700 Sat, 5 Nov 2005 09:44:10 +1100
- The 'Twighlight Zone' release
- Mike Schilli pointed out that strings without time zones
::More)
suggest we might turn the check into an ok() with our own comparison
operator.
Cheers!
Rick Measham
at the cell formats for dates available in Excel or OOo ..
that's probably a fair list of the most common human-dates.
Cheers!
Rick Measham
Dave Rolsky wrote:
Having a wiki would make this easier ;) I'll look for a place to set
one up.
I'm happy to host one (something with auth and good perl rendering) at
http://datetime.isite.net.au/ if you'd like.
Cheers!
Rick Measham
. (Remember
that offsets change through the year to account for DST as well)
Cheers!
Rick Measham
guess with no limit on hours)
Cheers!
Rick Measham
has booked a holiday for the weekend and she'll
be mildly annoyed if I work on DateTime :)
Thanks for your efforts Dave!
Cheers!
Rick Measham
to choose their math
assumptions.
Cheers!
Rick Measham
want, the format is '%.h:%m'
But as I said, that wont be happening until the date math is working for
non-UTC zones.
Cheers!
Rick Measham
::Duration tests also fail with the current
date math problems in DateTime, so once again you can ignore the failed
tests so long as you only want UTC durations formatted :))
Cheers!
Rick Measham
there are between two
dates, then I assume leap seconds will need to come into it also. I
can't imagine there are many DT users who want to use it for this
purpose. Those who do should be converting in and out of UTC themselves.
Cheers!
Rick Measham
',
# DT:Decorated:Strptime is an accessor interface to DT:F:Strp
'common',
# This will have all the 'ymd', 'mdy', 'dmy', 'hms' accessors
],
as = 'DTD';
my $dtd = DTD-now;
print $dtd-hms();
# 10:10:23
Cheers!
Rick Measham
1 - 100 of 271 matches
Mail list logo