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
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.
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.
If you do calendar math consider using a module designed for that.
Johan Lodin <email@example.com>
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.