Poky Project Discussions
 help / color / mirror / Atom feed
* [PATCH v2] Make /etc/timestamp usage consistent
@ 2010-11-04 11:39 Gary Thomas
  0 siblings, 0 replies; only message in thread
From: Gary Thomas @ 2010-11-04 11:39 UTC (permalink / raw)
  To: Poky

[-- Attachment #1: Type: text/plain, Size: 765 bytes --]

Per the previous discussion and bug #265, the use of /etc/timestamp?
is inconsistent:
   * Different scripts format this differently
   * Some places it's /etc/timestamp, others /etc/timestamp2

The attached patch cleans this up.  Also note that I switched to
always keeping the timestamp in UTC.  This is important for systems
without a notion of timezone (typical for those with no hardware
clock where this really matters).  You notice this the most when
the build/development environment is somewhere other than UTC :-)

-- 
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------

[-- Attachment #2: 0001-Make-etc-timestamp-usage-consistent.-Also-keep-tim.patch --]
[-- Type: text/plain, Size: 2623 bytes --]

From cf19242b0b8466b703581cc0b0ca981605c13007 Mon Sep 17 00:00:00 2001
From: Gary Thomas <gary@mlbassoc.com>
Date: Thu, 4 Nov 2010 05:34:12 -0600
Subject: [PATCH] Make /etc/timestamp usage consistent.  Also keep timestamp in UTC

Signed-off-by: Gary Thomas <gary@mlbassoc.com>
---
 meta/classes/image.bbclass                         |    4 ++--
 .../initscripts/initscripts-1.0/bootmisc.sh        |    8 ++++----
 .../initscripts/initscripts-1.0/save-rtc.sh        |    2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 3db34ac..4be5103 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -183,7 +183,7 @@ zap_root_password () {
 } 
 
 create_etc_timestamp() {
-	date +%2m%2d%2H%2M%Y >${IMAGE_ROOTFS}/etc/timestamp
+	date -u +%2m%2d%2H%2M%4Y >${IMAGE_ROOTFS}/etc/timestamp
 }
 
 # Turn any symbolic /sbin/init link into a file
@@ -217,7 +217,7 @@ set_image_autologin () {
 # Can be use to create /etc/timestamp during image construction to give a reasonably 
 # sane default time setting
 rootfs_update_timestamp () {
-	date "+%m%d%H%M%Y" >${IMAGE_ROOTFS}/etc/timestamp
+	date -u +%2m%2d%2H%2M%4Y >${IMAGE_ROOTFS}/etc/timestamp
 }
 
 # Prevent X from being started
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh b/meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh
index 162df2b..03fd67c 100755
--- a/meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh
+++ b/meta/recipes-core/initscripts/initscripts-1.0/bootmisc.sh
@@ -65,13 +65,13 @@ fi
 # If the timestamp is 1 day or more recent than the current time,
 # use the timestamp instead.
 /etc/init.d/hwclock.sh start
-if test -e /etc/timestamp2
+if test -e /etc/timestamp
 then
-	SYSTEMDATE=`date "+%Y%m%d%2H%2M"`
-	read TIMESTAMP < /etc/timestamp2
+	SYSTEMDATE=`date  -u +%2m%2d%2H%2M%4Y`
+	read TIMESTAMP < /etc/timestamp
         NEEDUPDATE=`expr \( $TIMESTAMP \> $SYSTEMDATE + 10000 \)`
         if [ $NEEDUPDATE -eq 1 ]; then 
-		date -s $TIMESTAMP
+		date -u $TIMESTAMP
 		/etc/init.d/hwclock.sh stop
 	fi
 fi
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh b/meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh
index 75e4300..77aa11c 100644
--- a/meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh
+++ b/meta/recipes-core/initscripts/initscripts-1.0/save-rtc.sh
@@ -10,4 +10,4 @@
 ### END INIT INFO
 
 # Update the timestamp
-date +%Y%m%d%2H%2M > /etc/timestamp2
+date -u +%2m%2d%2H%2M%4Y > /etc/timestamp
-- 
1.6.2.5


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2010-11-04 11:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-04 11:39 [PATCH v2] Make /etc/timestamp usage consistent Gary Thomas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox