sync bmc time from ipmb host

This script runs at startup as systemd service.
It checks if the bmc time is in sync from NTP server.
otherwise it reads the host time via ipmb interface
and updates as bmc time.

This change was tested and verified in yosemitev2 and tiogapass
platforms.

Signed-off-by: Naveen Moses <naveen.mosess@hcl.com>
Change-Id: I8c937c16415b2dd05d05155facadc0bed797db07
diff --git a/meta-facebook/recipes-phosphor/datetime/phosphor-time-manager_%.bbappend b/meta-facebook/recipes-phosphor/datetime/phosphor-time-manager_%.bbappend
new file mode 100644
index 0000000..97ea50d
--- /dev/null
+++ b/meta-facebook/recipes-phosphor/datetime/phosphor-time-manager_%.bbappend
@@ -0,0 +1,19 @@
+FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
+
+SRC_URI:append:fb-withhost += "file://set-bmc-time-from-host"
+
+
+RDEPENDS:${PN}:append:fb-withhost += "bash"
+
+do_install:append:fb-withhost(){
+
+    # Store the bitbake variable OBMC_HOST_INSTANCES  inside time sync script as HOST_INSTANCES variable using sed.
+    sed -i -e "s,HOST_INSTANCES_SED_REPLACEMENT_VALUE,${OBMC_HOST_INSTANCES},g" ${WORKDIR}/set-bmc-time-from-host
+
+    install -d ${D}$/lib/systemd/system
+    install -m 0644 ${WORKDIR}/bmc-set-time.service  ${D}$/lib/systemd/system
+    install -d ${D}/usr/libexec
+    install -m 0777 ${WORKDIR}/set-bmc-time-from-host ${D}/usr/libexec
+}
+
+SYSTEMD_SERVICE:${PN}:fb-withhost += "bmc-set-time.service"