[aprssig] Wanted perl time code

Andrew Rich (Home) vk4tec at tech-software.net
Wed Sep 2 06:47:00 EDT 2009


Thanks Bruce !


----------------------------------------------------------
Andrew Rich 
Airways Technical Officer Grade 4
Surveillance - RADAR ADS-B
Amateur Radio Callsign VK4TEC
email: vk4tec at tech-software.net
web: www.tech-software.net
  ----- Original Message ----- 
  From: Bruce Kreutzer 
  To: Andrew Rich (Home) ; TAPR APRS Mailing List 
  Sent: Wednesday, September 02, 2009 8:45 PM
  Subject: Re: [aprssig] Wanted perl time code


  Andrew-

  Perl has loads of time functionality.  The solution depends on what format the date you have is in.  There is also very good perl documentation online.  For example, google perl time diff.
  I found this page as an overview:  http://www.perl.com/lpt/a/718

  You can just subtract times in internal format:   $difftime = time() - $prevtime;
  Then print it using gmtime() to extract the individual values like this:
  my @z = gmtime($difftime);
  print "It has been $z(3) days, $z(2) hours, $z(1) minutes, $z(0) seconds since we last heard xxxx";

  (I haven't tried to actually run this code, but it should work).

  There may be easier/better/faster ways to write this, but it's readable, more or less.

  I can't answer the mysql question.

  Bruce
  ki4cpz


  On Wed, Sep 2, 2009 at 4:37 AM, Andrew Rich (Home) <vk4tec at tech-software.net> wrote:

    Hello

    I am looking for some perl code that can tell me the days, hours, minutes and seconds between two events

    Actually what I want is "It has been xxx since we last heard xxxx"

    Ideas ?

    Does MySQL have a time diff function ?

    ----------------------------------------------------------
    Andrew Rich 
    Airways Technical Officer Grade 4
    Surveillance - RADAR ADS-B
    Amateur Radio Callsign VK4TEC
    email: vk4tec at tech-software.net
    web: www.tech-software.net

    _______________________________________________
    aprssig mailing list
    aprssig at tapr.org
    https://www.tapr.org/cgi-bin/mailman/listinfo/aprssig






------------------------------------------------------------------------------



  No virus found in this incoming message.
  Checked by AVG - www.avg.com 
  Version: 8.5.409 / Virus Database: 270.13.75/2340 - Release Date: 09/01/09 20:03:00
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.tapr.org/pipermail/aprssig_lists.tapr.org/attachments/20090902/5a015b47/attachment.html>


More information about the aprssig mailing list