Menu

#5 penemo: `date` should be replaced with call to localtime()

open
nobody
None
5
2003-07-15
2003-07-15
Anonymous
No

In the penemo script, a call to `date` is made to
populate the $date field. This is also used when
applying a global pause.

However, `date` is likely to not use the same format
across platforms.

There is a built-in perl function, localtime(), which will
provide the following format when assigned in a scalar
context:
Tue Jul 15 15:37:58 2003

So, the following changes could be made:
$date = localtime(); # `date`;
# this happens twice in penemo, once in agent.pm, and
# once in penemo-admin.cgi

... and later, in convert_date_to_string():
my ($month, $day, $time, $year) =
($date[1], $date[2], $date[3], $date[4]);
# changed $date[5] to $date[4]

While I'm at it, I have to wonder why you didn't just
store the value of time() in the file for comparison,
instead of translating the string. Just a thought.

If you have any questions about this bug report, please
contact dpmott@sep.com.

Thanks!

Discussion


Log in to post a comment.