From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Carl Christopher Bavington @ Langley" Newsgroups: gmane.os.tru64.managers Subject: SUMMARY: Command or shell script to add times?. Date: Thu, 22 May 2003 14:28:52 +0100 Sender: tru64-unix-managers-owner@ornl.gov Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 X-Trace: main.gmane.org 1053610101 18199 80.91.224.249 (22 May 2003 13:28:21 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Thu, 22 May 2003 13:28:21 +0000 (UTC) Original-X-From: tru64-unix-managers-owner-gotm-tru64-unix-managers=m.gmane.org@sws1.ctd.ornl.gov Thu May 22 15:28:19 2003 Return-path: Original-Received: from sws1.ctd.ornl.gov ([160.91.22.101]) by main.gmane.org with smtp (Exim 3.35 #1 (Debian)) id 19Iq6V-0004eM-00 for ; Thu, 22 May 2003 15:27:32 +0200 Original-Received: (qmail 32517 invoked by uid 5); 22 May 2003 13:29:19 -0000 Original-Followup-To: poster Precedence: bulk Original-Received: (qmail 32508 invoked by uid 49493); 22 May 2003 13:29:19 -0000 Original-Received: from Carl.Bavington@ntl.com by sws1 by uid 49491 with qmail-scanner-1.14 (clamscan: 0.54. spamassassin: 2.50-cvs. Clear:SA:0(-1.7/5.0):. Processed in 0.402603 secs); 22 May 2003 13:29:19 -0000 Original-Received: from unknown (HELO emroute1.cind.ornl.gov) (160.91.4.119) by 0 with SMTP; 22 May 2003 13:29:19 -0000 Original-Received: from emroute1.cind.ornl.gov (localhost [127.0.0.1]) by emroute1.cind.ornl.gov (PMDF V6.2 #30669) with ESMTP id <0HFA00COHISSD9@emroute1.cind.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT tru64-unix-managers@ornl.gov) ; Thu, 22 May 2003 09:29:17 -0400 (EDT) Original-Received: from mast-dc0-sm04.private.ntl.com (cabletel1.cableol.net [194.168.3.4]) by emroute1.cind.ornl.gov (PMDF V6.2 #30669) with ESMTP id <0HFA00BFSISKK9@emroute1.cind.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT tru64-unix-managers@ornl.gov) ; Thu, 22 May 2003 09:29:09 -0400 (EDT) Original-Received: from mast-dc0-se03.private.ntl.com (unverified) by mast-dc0-sm04.private.ntl.com (Content Technologies SMTPRS 4.2.10) with ESMTP id for ; Thu, 22 May 2003 14:28:54 +0100 Original-Received: by mast-dc0-se03.private.ntl.com with Internet Mail Service (5.5.2656.59) id ; Thu, 22 May 2003 14:28:54 +0100 Content-return: allowed Original-To: "Tru64 Managers Mail Group \(E-mail\)" X-Mailer: Internet Mail Service (5.5.2656.59) Xref: main.gmane.org gmane.os.tru64.managers:4314 X-Report-Spam: http://spam.gmane.org/gmane.os.tru64.managers:4314 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