wok-next view xorg-server-tinyX/stuff/xorg-server-tinyX-1.5.3-boottimestamp.u @ rev 5195

slitaz-doc: fix version for 3.0
author Christophe Lincoln <pankso@slitaz.org>
date Sun Mar 28 17:16:33 2010 +0200 (2010-03-28)
parents
children
line source
1 diff --git xorg-server-1.5.3/os/log.c xorg-server-1.5.3/os/log.c
2 index 0860847..2c46f1a 100644
3 --- xorg-server-1.5.3/os/log.c
4 +++ xorg-server-1.5.3/os/log.c
5 @@ -255,6 +255,33 @@ LogVWrite(int verb, const char *f, va_list args)
6 static char tmpBuffer[1024];
7 int len = 0;
9 + struct timeval time;
10 + time_t tv_sec;
11 + suseconds_t tv_usec;
12 + static Bool first = TRUE;
13 + static time_t start_tv_sec;
14 + static suseconds_t start_usec;
15 + int diff_sec, diff_usec;
16 +
17 + gettimeofday(&time, NULL);
18 + tv_sec = time.tv_sec;
19 + tv_usec = time.tv_usec;
20 + if (first == TRUE) {
21 + start_tv_sec = tv_sec;
22 + start_usec = tv_usec;
23 + first = FALSE;
24 + }
25 + diff_sec = (int)difftime(tv_sec, start_tv_sec);
26 + diff_usec = (tv_usec - start_usec);
27 + if (diff_usec < 0) {
28 + diff_sec--;
29 + diff_usec += 1000000;
30 + }
31 + sprintf(tmpBuffer, "[%d sec: %06d usec]", diff_sec , diff_usec);
32 + len = strlen(tmpBuffer);
33 + if (logFile)
34 + fwrite(tmpBuffer, len, 1, logFile);
35 +
36 /*
37 * Since a va_list can only be processed once, write the string to a
38 * buffer, and then write the buffer out to the appropriate output