summaryrefslogtreecommitdiff
path: root/recipes-core/systemd
diff options
context:
space:
mode:
authorMax Krummenacher <max.krummenacher@toradex.com>2014-06-25 09:51:06 +0200
committerMax Krummenacher <max.krummenacher@toradex.com>2014-08-04 11:12:25 +0200
commit9471fb11f995b77e92f9a7874fe0e9832404e25b (patch)
treeaeed4b56cc8442f2556fbb58fa23fa7a8c5216cb /recipes-core/systemd
parent4b11541a7c2fbfcadb8c06b38785e0ceddc18e49 (diff)
timestamp-service: change to new timestamp format
Patch pending in meta-angstrom
Diffstat (limited to 'recipes-core/systemd')
-rw-r--r--recipes-core/systemd/timestamp-service.bbappend1
-rwxr-xr-xrecipes-core/systemd/timestamp-service/load-timestamp.sh18
2 files changed, 19 insertions, 0 deletions
diff --git a/recipes-core/systemd/timestamp-service.bbappend b/recipes-core/systemd/timestamp-service.bbappend
new file mode 100644
index 0000000..72d991c
--- /dev/null
+++ b/recipes-core/systemd/timestamp-service.bbappend
@@ -0,0 +1 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
diff --git a/recipes-core/systemd/timestamp-service/load-timestamp.sh b/recipes-core/systemd/timestamp-service/load-timestamp.sh
new file mode 100755
index 0000000..b34c7ca
--- /dev/null
+++ b/recipes-core/systemd/timestamp-service/load-timestamp.sh
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+# Set the system clock from hardware clock
+# If the timestamp is 1 day or more recent than the current time,
+# use the timestamp instead.
+SYSTEMDATE=$(/bin/date -u "+%4Y%2m%2d%2H%2M")
+
+TIMESTAMP=$(/bin/cat /etc/timestamp 2>/dev/null)
+
+if [ ${TIMESTAMP} -gt $SYSTEMDATE ] 2>/dev/null ; then
+ echo "Update systemtime from /etc/timestamp"
+ /bin/date -u ${TIMESTAMP#????}${TIMESTAMP%????????}
+fi
+
+if [ "$1" = "--save" ] ; then
+ /bin/date -u +%4Y%2m%2d%2H%2M > /etc/timestamp
+fi
+