BUILD_TIME in xserver
Clark Rawlins
clark.rawlins at escient.com
Thu Jun 7 08:00:46 PDT 2007
Hello,
I was attempting to build the xorg tree from the git sources and after a
few bumps I came to a problem with BUILD_TIME in the xserver subdir.
Despite looking in the mailing lists and googling for a discussion of
this issue I haven't found anything. If I missed something I apologize
and ask for your direction to appropriate place to look. Dito, if this
comment is in the wrong forum.
It seems that BUILD_TIME is populated by a call to date +'%H%M%S' at
configure time. Then BUILD_TIME is used in hw/xfree86/common/xf86Init.c
as an integer. The problem comes when the configure happens before
10:00am and after 9:00am. At that point the time is represented as a
number like 091245. The compiler treats it as an octal number because
of the leading 0 but it is an invalid octal number because it uses
digits greater than 8.
My solution is in the following patch. I prepend a one to the time to
insure it is always interpreted as a decimal integer and then add a
modulo 10000 to the calculation for t.tm_hour to remove it from the
hour.
diff --git a/configure.ac b/configure.ac
index 1f94556..f7bab26 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1948,7 +1948,7 @@ AM_CONDITIONAL(SUN_KBD_MODE, [test x$KBD_MODE_TYPE
= xsun])
BUILD_DATE="$(date +'%Y%m%d')"
AC_SUBST([BUILD_DATE])
-BUILD_TIME="$(date +'%H%M%S')"
+BUILD_TIME="$(date +'1%H%M%S')"
AC_SUBST([BUILD_TIME])
DIX_CFLAGS="-DHAVE_DIX_CONFIG_H $XSERVER_CFLAGS"
diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c
index 8423fca..6a6789b 100644
--- a/hw/xfree86/common/xf86Init.c
+++ b/hw/xfree86/common/xf86Init.c
@@ -1733,7 +1733,7 @@ xf86PrintBanner()
#if defined(BUILD_TIME)
t.tm_sec = BUILD_TIME % 100;
t.tm_min = (BUILD_TIME / 100) % 100;
- t.tm_hour = (BUILD_TIME / 10000);
+ t.tm_hour = (BUILD_TIME / 10000) % 10000;
if (strftime(buf, sizeof(buf), "%d %B %Y %I:%M:%s%p", &t))
ErrorF("Build Date: %s\n", buf);
#else
More information about the xorg
mailing list