SUMMARY: Command or shell script to add times?.
From: Carl Christopher Bavington _at_ Langley (_at_)
Date: 05/22/03
- Previous message: Nagy Erno: "heimdal kerberos + ldap"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Thu, 22 May 2003 14:28:52 +0100 To: "Tru64 Managers Mail Group (E-mail)" <tru64-unix-managers@ornl.gov>
Thanks to Dr Tim Cutts.
I did it in ksh instead, adding 40 if gt than 59 etc, etc.
But Dr Tim suggested.
Fairly easy to do with an in-line perl script:
#!/bin/sh
addtime() {
perl -e 'use integer;
my ($h, $m, $s) = ($ARGV[0] =~ m/\G(\d\d)/g);
if (($s += $ARGV[1]) >= 60) {
$m += ($s/60); $s %= 60;
if ($m >= 60) { $h += ($m/60); $m %= 60; }
$h %= 24;
}
printf "%02d%02d%02d\n", $h,$m,$s;' $1 $2
}
addtime 235859 5
The contents of this email and any attachments are sent for the personal attention
of the addressee(s) only and may be confidential. If you are not the intended
addressee, any use, disclosure or copying of this email and any attachments is
unauthorised - please notify the sender by return and delete the message. Any
representations or commitments expressed in this email are subject to contract.
ntl Group Limited
- Previous message: Nagy Erno: "heimdal kerberos + ldap"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|