SUMMARY: Command or shell script to add times?.

From: Carl Christopher Bavington _at_ Langley (_at_)
Date: 05/22/03

  • Next message: Wakeman, Lindsay: "keyboard problem (booted off 40.F cdrom)"
    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


  • Next message: Wakeman, Lindsay: "keyboard problem (booted off 40.F cdrom)"

    Relevant Pages

    • RE: Calling functions using variable (I mean symbolic refs)
      ... >I have a Perl script with lot of functions. ... >Confidentiality Notice ... >and destroy all copies of this message and any attachments. ... you are not the intended recipient, please notify the sender at Wipro or Mailadmin@wipro.com immediately ...
      (perl.beginners)
    • Re: dynamic IPSEC: Holy grail sighted
      ... Hash: SHA1 ... I don't some of the attachments you intended to send (raccoon.conf? ...
      (FreeBSD-Security)
    • Re: dynamic IPSEC: Holy grail sighted
      ... Hash: SHA1 ... I don't some of the attachments you intended to send (raccoon.conf? ...
      (freebsd-questions)
    • problem with strings
      ... I have a problem with string passed as an argument to a perl script. ... argument to the cmdtemplate option. ... The information contained in this electronic message and any attachments to this message are intended ... you are not the intended recipient, please notify the sender at Wipro or Mailadmin@wipro.com immediately ...
      (perl.beginners)
    • Error on DBD::Oracle
      ... I am getting the following error while I was running a perl script. ... The information contained in this electronic message and any attachments to this message are intended ... you are not the intended recipient, please notify the sender at Wipro or Mailadmin@wipro.com immediately ...
      (perl.dbi.users)