daemontools-0.76: ns accuracy for taia_now
Sami Farin <[email protected]> Wed, 29 Aug 2007 20:07:38 +0300
| Newsgroups | gmane.org.djb.miscellaneous |
|---|---|
| Message-ID | <[email protected]> |
--62cnsdzoay3jkhk5
Content-Type: multipart/mixed; boundary="54x225bnfp7fvkl6"
Content-Disposition: inline
--54x225bnfp7fvkl6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
=2E..if your system has clock_gettime.
You may or may not need -lrt.
To test:
$ echo hi|tai64n|tai64nlocal
2007-08-29 19:57:27.380816809 hi
To (hopefully) restart multilogs:
# kill $(lsof -c multilog -t)
or if you use supervise:
# svc -t /service/*/log
--=20
Do what you love because life is too short for anything else.
--54x225bnfp7fvkl6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="daemontools-0.76-clock_gettime.patch"
Content-Transfer-Encoding: quoted-printable
--- daemontools-0.76/src/taia_now.c.bak 2001-07-12 19:49:49.000000000 +0300
+++ daemontools-0.76/src/taia_now.c 2007-08-29 19:32:48.256135506 +0300
@@ -2,14 +2,15 @@
=20
#include <sys/types.h>
#include <time.h>
-#include <sys/time.h>
#include "taia.h"
=20
void taia_now(struct taia *t)
{
- struct timeval now;
- gettimeofday(&now,(struct timezone *) 0);
- tai_unix(&t->sec,now.tv_sec);
- t->nano =3D 1000 * now.tv_usec + 500;
+ struct timespec now;
+
+ clock_gettime(CLOCK_REALTIME, &now);
+ tai_unix(&t->sec, now.tv_sec);
+ t->nano =3D now.tv_nsec;
t->atto =3D 0;
}
+
--- daemontools-0.76/src/Makefile.bak 2001-07-12 19:49:49.000000000 +0300
+++ daemontools-0.76/src/Makefile 2007-08-29 19:52:54.525841540 +0300
@@ -206,7 +206,7 @@ matchtest.o: buffer.h compile match.h ma
=20
multilog: byte.a deepsleep.o load match.o multilog.o time.a \
timestamp.o unix.a
- ./load multilog deepsleep.o timestamp.o match.o time.a unix.a byte.a=20
+ ./load multilog deepsleep.o timestamp.o match.o time.a unix.a byte.a -lrt
=20
multilog.o: alloc.h buffer.h byte.h coe.h compile deepsleep.h \
direntry.h env.h error.h fd.h lock.h match.h multilog.c open.h scan.h \
@@ -360,7 +360,7 @@ subgetopt.o: compile subgetopt.c subgeto
./compile subgetopt.c
=20
supervise: byte.a deepsleep.o load supervise.o time.a unix.a
- ./load supervise deepsleep.o time.a unix.a byte.a=20
+ ./load supervise deepsleep.o time.a unix.a byte.a -lrt
=20
supervise.o: coe.h compile deepsleep.h env.h error.h fifo.h iopause.h \
lock.h ndelay.h open.h sig.h strerr.h supervise.c tai.h taia.h \
@@ -421,7 +421,7 @@ systype: find-systype.sh trycpp.c x86cpu
sh find-systype.sh > systype
=20
tai64n: byte.a load tai64n.o time.a timestamp.o unix.a
- ./load tai64n timestamp.o time.a unix.a byte.a=20
+ ./load tai64n timestamp.o time.a unix.a byte.a -lrt
=20
tai64n.o: buffer.h compile tai64n.c timestamp.h
./compile tai64n.c
--54x225bnfp7fvkl6--
--62cnsdzoay3jkhk5
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.3 (GNU/Linux)
iD8DBQFG1afaMCYCLUwuV18RAtCFAKDlhn/u6yoSTGYsHQ9JO0uWvIu9IgCgjJtz
XVLsrO9NuXWBFGJ93BpV6lQ=
=A/76
-----END PGP SIGNATURE-----
--62cnsdzoay3jkhk5--