Time::Consts - Define time constants with specified base
# Define all constants. use Time::Consts qw/ :ALL /; # Define just MIN and HOUR. use Time::Consts qw/ MIN HOUR /; # Set MIN to base, i.e. SEC = 1/60, MIN = 1, etc. use Time::Consts qw/ min SEC MIN /;
Time::Consts can define time constants for you. Those available are
Time::Consts
MSEC SEC MIN HOUR DAY WEEK
and are provided as arguments to the use() statements. An ':ALL' tag is provided to export all of the above. Default base is seconds, but that can be changed by supplying a lowercase version of any of the constants to the use statement. Note that giving a lowercase base doesn't mean that the corresponding constant automatically will be defined.
use()
use
If you at any time would want to have any of the constants in another base than the one given to the use() statement just divide with that constant. E.g. WEEK / HOUR will always return 168, i.e. the number of hours per week.
WEEK / HOUR
If you do calendar math consider using a module designed for that.
(F) Self-explanatory.
Johan Lodin <lodin@cpan.org>
Copyright 2004-2005 Johan Lodin. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Time::Seconds
To install Time::Consts, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Time::Consts
CPAN shell
perl -MCPAN -e shell install Time::Consts
For more information on module installation, please visit the detailed CPAN module installation guide.