Tatsuhiko Miyagawa > Dunce-time > Dunce::time::Zerofill

Download:
Dunce-time-0.02.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.02   Source  

NAME ^

Dunce::time::Zerofill - Protects against sloppy use of time.

SYNOPSIS ^

  use Dunce::time::Zerofill;

  # time() returns zero-filled 10 digit time.
  my $this = time;

  print $this;     #  '0992251492'
  print $this + 0; # as used to be, 992251492 for numerically context

  # for 11 digit time
  use Dunce::time::Zerofill '11'; # not numeric 11, interpreted as versoin

DESCRIPTION ^

On Sun Sep 9 01:46:40 2001 GMT, time_t (UNIX epoch) reaches 10 digits. So, we should use already zero-filled 10 digit time_t!

When Dunce::time::Zerofill is used, it provides special version of time() which returns zero-filled time. It doesn't break anything in numeric context, and comparing times as string will lead to "0992251492 comes before 1000000000", which should be an expected result.

AUTHOR ^

Tatsuhiko Miyagawa <miyagawa@bulknews.net>, with idea from M. Simon Cavalletto <simonm@evolution.com>.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO ^

Dunce::time, D::oh::Year.

syntax highlighting: