APM: Unix time help
Mike Stok
mike at stok.co.uk
Tue Sep 24 12:59:05 CDT 2002
On Tue, 24 Sep 2002, Goldilox wrote:
> I want to convert -M $file output to Unix time (or -M's equivalent seconds so I
> can create its corresponding Unix time).
>
> I also want to convert dates to their corresponding Unix time.
>
> Anyone know of a module or code snippet(s)? Thanks
[mike at won mike]$ ls -l /etc/passwd
-rw-r--r-- 1 root root 1328 Sep 16 06:56 /etc/passwd
[mike at won mike]$ perl -de 1
Loading DB routines from perl5db.pl version 1.19
Editor support available.
Enter h or `h h' for help, or `man perldebug' for more help.
main::(-e:1): 1
DB<1> $t = -M '/etc/passwd'
DB<2> print scalar localtime $^T - $t * 24 * 60 * 60
Mon Sep 16 06:56:11 2002
Hope this helps,
Mike
--
mike at stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | GPG PGP Key 1024D/059913DA
mike at exegenix.com | Fingerprint 0570 71CD 6790 7C28 3D60
http://www.exegenix.com/ | 75D2 9EC4 C1C0 0599 13DA
More information about the Austin
mailing list