From 03f76ac0f600ded5975ced8b8351e1a9837f7977 Mon Sep 17 00:00:00 2001 From: ayer1 Date: Thu, 1 Apr 2010 14:46:27 +0000 Subject: [PATCH] added command to set current time from app space. --- tos/platforms/shimmer/Time.nc | 1 + tos/platforms/shimmer/TimeP.nc | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/tos/platforms/shimmer/Time.nc b/tos/platforms/shimmer/Time.nc index 76e2a011..530d66a6 100644 --- a/tos/platforms/shimmer/Time.nc +++ b/tos/platforms/shimmer/Time.nc @@ -37,5 +37,6 @@ interface Time { command error_t localtime(const time_t *timer, struct tm *tm); command error_t asctime(const struct tm *tm, char *buf, int buflen); command error_t time(time_t *timer); + command void setCurrentTime(time_t current_time); event void tick(); } diff --git a/tos/platforms/shimmer/TimeP.nc b/tos/platforms/shimmer/TimeP.nc index 53409391..4aa2b981 100644 --- a/tos/platforms/shimmer/TimeP.nc +++ b/tos/platforms/shimmer/TimeP.nc @@ -74,6 +74,11 @@ extern int snprintf(char *str, size_t len, const char *format, ...) __attribute_ return SUCCESS; } + command void Time.setCurrentTime(time_t current_time){ + atomic g_current_time = current_time; + g_local_time = call LocalTime64.get(); + } + void dotick(int force) { time_t tick = call LocalTime64.get(); if (force || tick >= (g_tick_local_time + 32768L*10)) { -- 2.39.2