Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 05 Nov 2000 23:26:04 -0800
From:      Marcel Moolenaar <marcel@cup.hp.com>
To:        "John W. De Boskey" <jwd@bsdwins.com>
Cc:        "David O'Brien" <obrien@FreeBSD.org>, "Jordan K. Hubbard" <jkh@FreeBSD.org>, cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src Makefile
Message-ID:  <3A065D0C.7F65C0A0@cup.hp.com>
References:  <200011052244.OAA60716@freefall.freebsd.org> <20001105161514.A7914@dragon.nuxi.com> <20001105193652.A14868@bsdwins.com> <3A06250E.E752CF4B@cup.hp.com> <20001106015759.A16228@bsdwins.com>

next in thread | previous in thread | raw e-mail | index | archive | help
"John W. De Boskey" wrote:
> 
> How about something like the following:
> 
> STARTSECS!= date +%s
> 
> all:
>         @echo ">>> ${OBJFORMAT} make world started on `LC_TIME=C date`"
>         sleep 2
>         @echo ">>> ${OBJFORMAT} make world completed on `LC_TIME=C date`"
>         @echo ">>> ${OBJFORMAT} make world duration `TZ=GMT date -r \`expr \\\`date +%s\\\` - ${STA RTSECS}\` +%H:%M:%S`"
> 
> That last line is a bit dicey, but it works...

Exactly!

What's the maximum duration for which this still works? I mean, does it
work if the differences if more than 24 hours for example?

Just for comparison the following perl script I hacked together for
demonstration purposes (not that we should use perl, but it's a proof of
concept):

#!/usr/bin/perl

my $t1 = time;
my $t1s = localtime($t1);
printf "t1 = $t1 ($t1s)\n";

my $t2 = $t1 + 86400 + 10800 + 1680 + 14;
my $t2s = localtime($t2);
printf "t2 = $t2 ($t2s)\n";

my $dt = $t2 - $t1;
my $dts = gmtime($dt);
($wday, $mon, $day, $time, $year) = split /[ ]+/, $dts;
$day -= 1;
printf "dt = $dt ($day.$time)\n";

Output:

t1 = 973495143 (Sun Nov  5 23:19:03 2000)
t2 = 973594037 (Tue Nov  7 02:47:17 2000)
dt = 98894 (1.03:28:14)

> I'll turn this into a patch if you folks think it's reasonable. I can
> either send it to Jordan, or commit it.

If it handles at least a couple of days, then I think it's reasonable.
Let's wait and see what obrien and jkh think about it...

-- 
Marcel Moolenaar
  mail: marcel@cup.hp.com / marcel@FreeBSD.org
  tel:  (408) 447-4222


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3A065D0C.7F65C0A0>