in reply to Re: Time to seconds
in thread Time to seconds
Unfortunately, even that's not a complete solution, because the epoch is not Jan 1, 1970 on all platforms. On the Macintosh, for example, it's Jan 1, 1904, and the output is 2082830523.use Time::Local; my ($hours, $minutes, $seconds) = (1, 2, 3); #insert your regex here print timegm($seconds, $minutes, $hours, 1, 0, 70);
There's still a way to do it with timelocal, though:
The choice of year is relatively arbitrary, but note that you mustn't pick a time of year that will be affected by daylight savings.use Time::Local; my ($hours, $minutes, $seconds) = (1, 2, 3); #insert your regex here print timelocal($seconds, $minutes, $hours, 1, 0, 100) - timelocal(0, 0, 0, 1, 0, 100);
So, you can solve this problem using Time::Local, you just have to be careful about how you do it.
|
|---|