8005442: autogen.sh sets DATE_WHEN_GENERATED to empty string on Solaris version 11 or later
authortbell
Mon, 07 Jan 2013 14:01:09 -0800
changeset 15065 7c06e7f756ee
parent 15064 049338f0fb4e
child 15066 7941da20620c
8005442: autogen.sh sets DATE_WHEN_GENERATED to empty string on Solaris version 11 or later Reviewed-by: ohair
common/autoconf/autogen.sh
--- a/common/autoconf/autogen.sh	Fri Jan 04 21:04:03 2013 -0800
+++ b/common/autoconf/autogen.sh	Mon Jan 07 14:01:09 2013 -0800
@@ -26,9 +26,11 @@
 
 # Create a timestamp as seconds since epoch
 if test "x`uname -s`" = "xSunOS"; then
-  # date +%s is not available on Solaris, use this workaround
-  # from http://solarisjedi.blogspot.co.uk/2006/06/solaris-date-command-and-epoch-time.html
-  TIMESTAMP=`/usr/bin/truss /usr/bin/date 2>&1 |  nawk -F= '/^time\(\)/ {gsub(/ /,"",$2);print $2}'`
+  TIMESTAMP=`date +%s`
+  if test "x$TIMESTAMP" = "x%s"; then
+    # date +%s not available on this Solaris, use workaround from nawk(1):
+    TIMESTAMP=`nawk 'BEGIN{print srand()}'`
+  fi
 else
   TIMESTAMP=`date +%s`
 fi