Discussion:
[devinfo] TIME::Piece
brian read
2017-12-15 16:37:24 UTC
Permalink
I am trying to do some date arithmetic, googling I get this:

use Time::Piece;
use Time::Seconds;
my $t = localtime() - $daysKeepLogData * ONE_DAY;
$firstDay = $t->ymd;

However the TIME:Piece module does not seem to be part of the SMEServer
install, so can someone give me an equivalent?

this is for an enhanced mailstats, details to be announced in a while!!

Cheers  Brian
Jonathan Martens
2017-12-15 19:24:37 UTC
Permalink
Wouldn't Date::Manip
(http://search.cpan.org/dist/Date-Manip/lib/Date/Manip/Examples.pod#TO_ADD_AN_AMOUNT_OF_TIME_TO_A_DATE)
or Time::Duration
(http://search.cpan.org/~avif/Time-Duration/Duration.pm) contain any
libs you can use?


Kind regards,


Jonathan
Post by brian read
use Time::Piece;
use Time::Seconds;
my $t = localtime() - $daysKeepLogData * ONE_DAY;
$firstDay = $t->ymd;
However the TIME:Piece module does not seem to be part of the
SMEServer install, so can someone give me an equivalent?
this is for an enhanced mailstats, details to be announced in a while!!
Cheers  Brian
_______________________________________________
Server Development Discussion
Searchable archive at https://lists.contribs.org/mailman/public/devinfo/
Jonathan Martens
2017-12-15 19:36:48 UTC
Permalink
Brian,


Not sure, but at least they are available on SME Server and most likely
can be specified as dependencies in your RPM. If the build system still
is capable of dragging in dependencies you should be good to go.

Oh, and one kind reminder, please respond to the list, instead directly
to my e-mail to keep everyone informed. :-)


Kind regards,


Jonathan
They might do.  Are they part of the standard smeserver? Perl is not
one of my strong points.
Cheers Brian
Sent from my phone using the blue email client.
Wouldn't Date::Manip
(http://search.cpan.org/dist/Date-Manip/lib/Date/Manip/Examples.pod#TO_ADD_AN_AMOUNT_OF_TIME_TO_A_DATE)
or Time::Duration
(http://search.cpan.org/~avif/Time-Duration/Duration.pm) contain
any libs you can use?
Kind regards,
Jonathan
Post by brian read
use Time::Piece;
use Time::Seconds;
my $t = localtime() - $daysKeepLogData * ONE_DAY;
$firstDay = $t->ymd;
However the TIME:Piece module does not seem to be part of the
SMEServer install, so can someone give me an equivalent?
this is for an enhanced mailstats, details to be announced in a while!!
Cheers  Brian
_______________________________________________
Server Development Discussion
Searchable archive athttps://lists.contribs.org/mailman/public/devinfo/
------------------------------------------------------------------------
Server Development Discussion
Searchable archive athttps://lists.contribs.org/mailman/public/devinfo/
Brian Read
2017-12-15 19:51:22 UTC
Permalink
Thanks I'll look into those  sorry about not replying to the list. I'm on my phone  I tried to copy it to the list but the send failed.

⁣Cheers Brian
Sent from my phone using the blue email client.​
Post by Jonathan Martens
Brian,
Not sure, but at least they are available on SME Server and most likely
can be specified as dependencies in your RPM. If the build system still
is capable of dragging in dependencies you should be good to go.
Oh, and one kind reminder, please respond to the list, instead directly
to my e-mail to keep everyone informed. :-)
Kind regards,
Jonathan
They might do.  Are they part of the standard smeserver? Perl is not
one of my strong points.
Cheers Brian
Sent from my phone using the blue email client.
Wouldn't Date::Manip
(http://search.cpan.org/dist/Date-Manip/lib/Date/Manip/Examples.pod#TO_ADD_AN_AMOUNT_OF_TIME_TO_A_DATE)
or Time::Duration
(http://search.cpan.org/~avif/Time-Duration/Duration.pm) contain
any libs you can use?
Kind regards,
Jonathan
Post by brian read
use Time::Piece;
use Time::Seconds;
my $t = localtime() - $daysKeepLogData * ONE_DAY;
$firstDay = $t->ymd;
However the TIME:Piece module does not seem to be part of the
SMEServer install, so can someone give me an equivalent?
this is for an enhanced mailstats, details to be announced in a while!!
Cheers  Brian
_______________________________________________
Server Development Discussion
Searchable archive
athttps://lists.contribs.org/mailman/public/devinfo/
------------------------------------------------------------------------
Server Development Discussion
Searchable archive
athttps://lists.contribs.org/mailman/public/devinfo/
------------------------------------------------------------------------
_______________________________________________
Server Development Discussion
Searchable archive at
https://lists.contribs.org/mailman/public/devinfo/
brian read
2017-12-15 22:17:29 UTC
Permalink
I've decided for now to install the perl-TIme-Pieces rpm (it comes
without needing an extra repo).

If someone comes up with an alternative not requiring an extra package,
then I'll think again.


Cheers Brian
Post by Brian Read
Thanks I'll look into those  sorry about not replying to the list. I'm
on my phone  I tried to copy it to the list but the send failed.
Cheers Brian
Sent from my phone using the blue email client.
Brian,
Not sure, but at least they are available on SME Server and most
likely can be specified as dependencies in your RPM. If the build
system still is capable of dragging in dependencies you should be
good to go.
Oh, and one kind reminder, please respond to the list, instead
directly to my e-mail to keep everyone informed. :-)
Kind regards,
Jonathan
They might do.  Are they part of the standard smeserver? Perl is
not one of my strong points.
Cheers Brian
Sent from my phone using the blue email client.
Wouldn't Date::Manip
(http://search.cpan.org/dist/Date-Manip/lib/Date/Manip/Examples.pod#TO_ADD_AN_AMOUNT_OF_TIME_TO_A_DATE)
or Time::Duration
(http://search.cpan.org/~avif/Time-Duration/Duration.pm)
contain any libs you can use?
Kind regards,
Jonathan
Post by brian read
use Time::Piece;
use Time::Seconds;
my $t = localtime() - $daysKeepLogData * ONE_DAY;
$firstDay = $t->ymd;
However the TIME:Piece module does not seem to be part of
the SMEServer install, so can someone give me an equivalent?
this is for an enhanced mailstats, details to be announced in a while!!
Cheers  Brian
_______________________________________________
Server Development Discussion
Searchable archive athttps://lists.contribs.org/mailman/public/devinfo/
------------------------------------------------------------------------
Server Development Discussion
Searchable archive athttps://lists.contribs.org/mailman/public/devinfo/
------------------------------------------------------------------------
Server Development Discussion
Searchable archive athttps://lists.contribs.org/mailman/public/devinfo/
Brian Read
2017-12-15 19:37:01 UTC
Permalink
They might do.  Are they part of the standard smeserver? Perl is not one of my strong points.

⁣Cheers Brian
Sent from my phone using the blue email client.​
Post by Jonathan Martens
Wouldn't Date::Manip
(http://search.cpan.org/dist/Date-Manip/lib/Date/Manip/Examples.pod#TO_ADD_AN_AMOUNT_OF_TIME_TO_A_DATE)
or Time::Duration
(http://search.cpan.org/~avif/Time-Duration/Duration.pm) contain any
libs you can use?
Kind regards,
Jonathan
Post by brian read
use Time::Piece;
use Time::Seconds;
my $t = localtime() - $daysKeepLogData * ONE_DAY;
$firstDay = $t->ymd;
However the TIME:Piece module does not seem to be part of the
SMEServer install, so can someone give me an equivalent?
this is for an enhanced mailstats, details to be announced in a
while!!
Post by brian read
Cheers  Brian
_______________________________________________
Server Development Discussion
Searchable archive at
https://lists.contribs.org/mailman/public/devinfo/
------------------------------------------------------------------------
_______________________________________________
Server Development Discussion
Searchable archive at
https://lists.contribs.org/mailman/public/devinfo/
Jean-Philippe Pialasse
2017-12-17 20:54:56 UTC
Permalink
There might be something already around, but if you need this one it is available on centos repo

Jean-Philippe Pialasse
Wouldn't Date::Manip (http://search.cpan.org/dist/Date-Manip/lib/Date/Manip/Examples.pod#TO_ADD_AN_AMOUNT_OF_TIME_TO_A_DATE) or Time::Duration (http://search.cpan.org/~avif/Time-Duration/Duration.pm) contain any libs you can use?
Kind regards,
Jonathan
Post by brian read
use Time::Piece;
use Time::Seconds;
my $t = localtime() - $daysKeepLogData * ONE_DAY;
$firstDay = $t->ymd;
However the TIME:Piece module does not seem to be part of the SMEServer install, so can someone give me an equivalent?
this is for an enhanced mailstats, details to be announced in a while!!
Cheers Brian
_______________________________________________
Server Development Discussion
Searchable archive at https://lists.contribs.org/mailman/public/devinfo/
_______________________________________________
Server Development Discussion
Searchable archive at https://lists.contribs.org/mailman/public/devinfo/
Dave Liquorice
2017-12-18 09:13:31 UTC
Permalink
Post by brian read
use Time::Piece;
use Time::Seconds;
my $t = localtime() - $daysKeepLogData * ONE_DAY;
$firstDay = $t->ymd;
However the TIME:Piece module does not seem to be part of the SMEServer
install, so can someone give me an equivalent?
Can't you just use time() to get seconds since epoch, do the maths and
strftime("%Y-%m-%d") the result to the string?
--
Cheers
Dave.


_______________________________________________
Server Development Discussion
To unsubscribe, e-mail devinfo-***@lists.contribs.org
Searchable archive at https://lists.contribs.org/mailman/public/devinfo/
brian read
2017-12-19 06:21:08 UTC
Permalink
Post by Dave Liquorice
Post by brian read
use Time::Piece;
use Time::Seconds;
my $t = localtime() - $daysKeepLogData * ONE_DAY;
$firstDay = $t->ymd;
However the TIME:Piece module does not seem to be part of the SMEServer
install, so can someone give me an equivalent?
Can't you just use time() to get seconds since epoch, do the maths and
strftime("%Y-%m-%d") the result to the string?
yes indeed - many thanks. Incidentally  %F gives me the format I need
for a MySQL date.

Loading...