Epoch(3) User Contributed Perl Documentation Epoch(3)NAME
Time::Epoch - Convert between Perl epoch and other epochs
SYNOPSIS
#!/usr/bin/perl -wl
use Time::Epoch;
my $perlsec = 966770660; # Sun Aug 20 07:24:21 2000 -0400 on Mac OS
my $epochsec = perl2epoch($perlsec, 'macos', '-0400');
my $perlsec2 = epoch2perl($epochsec, 'macos', '-0400');
print $perlsec;
print $perlsec2;
print $epochsec;
# correct time on Unix:
print scalar localtime $perlsec;
# correct time on Mac OS (-0400):
print scalar localtime $epochsec;
DESCRIPTION
Exports two functions, "perl2epoch" and "epoch2perl". Currently only goes between Perl (Unix) epoch and Mac OS epoch. This is in
preparation for an eventual move of Perl to its own universal epoch, so we can get the system epoch of any platform that differs from
Perl's.
Epochs
o macos
Takes additional optional parameter of time zone differential. If time zone differential not supplied, we guess by getting the
different between "localtime" and "gmtime" with <Time::Local::timelocal>.
BUGS
o Hm. With the above test, "scalar localtime $perlsec" under my Linux box and "scalar localtime $epochsec" under my Mac OS box are off
by one second from each other. Maybe a leap second thing? Odd.
AUTHOR
Chris Nandor <pudge@pobox.com>, http://pudge.net/
Copyright (c) 2000-2003 Chris Nandor. All rights reserved. This program is free software; you can redistribute it and/or modify it under
the terms of the Artistic License, distributed with Perl.
SEE ALSO perl(1), perlport(1), Time::Local.
perl v5.16.2 2003-05-21 Epoch(3)
Check Out this Related Man Page
DateTime::Format::Epoch::Unix(3pm) User Contributed Perl Documentation DateTime::Format::Epoch::Unix(3pm)NAME
DateTime::Format::Epoch::Unix - Convert DateTimes to/from Unix epoch seconds
SYNOPSIS
use DateTime::Format::Epoch::Unix;
my $dt = DateTime::Format::Epoch::Unix->parse_datetime( 1051488000 );
# 2003-04-28T00:00:00
DateTime::Format::Epoch::Unix->format_datetime($dt);
# 1051488000
my $formatter = DateTime::Format::Epoch::Unix->new();
my $dt2 = $formatter->parse_datetime( 1051488000 );
$formatter->format_datetime($dt2);
DESCRIPTION
This module can convert a DateTime object (or any object that can be converted to a DateTime object) to the number of seconds since the
Unix epoch.
METHODS
Most of the methods are the same as those in DateTime::Format::Epoch. The only difference is the constructor.
o new()
Constructor of the formatter/parser object. It has no parameters.
SUPPORT
Support for this module is provided via the datetime@perl.org email list. See http://lists.perl.org/ for more details.
AUTHOR
Eugene van der Pijll <pijll@gmx.net>
COPYRIGHT
Copyright (c) 2003 Eugene van der Pijll. All rights reserved. This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
SEE ALSO
DateTime
datetime@perl.org mailing list
perl v5.10.1 2007-12-03 DateTime::Format::Epoch::Unix(3pm)
I am using the Linksys router as my hub to network my Win 2000 PC and Unix box to the cable modem. However, I can only get connection for my Win 2000 PC. The Unix box was able to get connection initially (yesterday) but when I reboot the machine this morning, the network went dead. What did I do... (6 Replies)
Are the Terminal commands used in Mac OS 10.1.3 the same as those found on a real Unix system? if they are, what book would you recommend as a terminal refferance guide?
I already have 'The Missing Manual' by O'Reilly, but there ain't much in terms of managing the system via the terminal :(
... (9 Replies)
Hey,
I've been a windows guy all my life, but i have finally decided to move to Unix and buy a Mac. I am pretty good with a lot of programming applications on windows, but was wondering if u guys had any advice on how to get started on Unix, like books to read, applications to buy, websites,... (8 Replies)
I have some text:
0400-0427 NA Czech Republic R. Prague 5990ca, 6200, 7345
0400-0456 NA, As Romania R. Romania Int'l 6115, 9515, 9690,
11895
0400-0500 NA U. S. A. WYFR 6065, 6855, 9505,
9715
0400-0500 NA,Eu,Af U. S. A. ... (8 Replies)
I know how to install Unix or Linux on my Mac using bootcamp, I installed the Ubuntu distribution of Linux on my Mac. Basically I'm looking for advice on what OS I should learn with. I am fiercely interested in programming, and am learning C++ and Python at the moment.
Anyways, everyone has... (5 Replies)
munt=`date '+%m` will isolate the month in digit form 02 = Feb
Trying to get the same out of perl just cant see it
$stimx = localtime($^T);
print ((split/ /,$stimx)); (4 Replies)
Hi guys,
I know that this topic has been discuss numerous times, and I have search the net and this forum for it.
However, non able to address the problem I faced so far.
I am on Solaris Platform and unable to install additional packages like the GNU date and gawk to make use of their... (5 Replies)
I've been trying to figure this out since last night, and I'm just stumped. The last time I did any shell scripting was 8 years ago on a Unix box, and it was never my strong suit. I'm on a Mac running Leopard now. Here's my dilemma - hopefully someone can point me in the right direction.
I'm... (10 Replies)
I have a list of interfaces and time the interface was last active. I can't figure out how to convert the time in the second column,
Fa1/14 0
Se0/0/0 0
Fa1/11 0
Fa1/9 0
Fa1/0 0
Se0/0/1 1240401408
Gi1/0 0
Fa0/0 1240401408
Fa1/3 0
Fa1/8 0
Fa1/15 0
Fa1/13 0
Fa1/10 0
Fa1/1 0
Fa1/12... (7 Replies)
var=50
perl -le "print scalar localtime (time() - "$var"*60);"
The above does subtraction of time,but i need the time format to be
date +%Y%m%d%H%M%S.
How can i achive this (6 Replies)
Hi everybody,
I want to get the current time in epoch format (in UNIX or Korn Shell) and store it in a variable called
currentTime. Any response will be highly appreciated:)
Thanks in advance,
omoyne:D (8 Replies)
I have a Raspberry Pi that logs some temperatures using Onewire. Data is collected with RRDTool.
The command sudo rrdtool fetch ute_temp.rrd AVERAGE -s -1h > ./test.log
and then cat test.log gives the result
1388608500: 2.3579639836e+00
.
How do I write a script that converts the Epoch time... (4 Replies)
Yesterday someone asked me to install TeamViewer and share my Mac screen with them while on a conference call.
I shut down my Mac before sleeping and woke up to some major problem with my 12-core CPU in hyperdrive, and the system activity monitor showed my Mac kernel_task was at 1,200% and the... (30 Replies)
why,just beacuse that its the bottom layer uses a small amount of bsd code? In my opinion, macos and Unix are completely different. The directories are long directory structures. For example, /application, /system, /user, /volumes, etc. are completely different from the traditional /bin/ /sbin... (5 Replies)