From: ayer1 Date: Thu, 1 Apr 2010 14:46:27 +0000 (+0000) Subject: added command to set current time from app space. X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=commitdiff_plain;h=03f76ac0f600ded5975ced8b8351e1a9837f7977;hp=80947dbfb5b56d7b65bc51a4518b320643821ab3;p=tinyos-2.x.git added command to set current time from app space. --- 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)) {