]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
added command to set current time from app space.
authorayer1 <ayer1>
Thu, 1 Apr 2010 14:46:27 +0000 (14:46 +0000)
committerayer1 <ayer1>
Thu, 1 Apr 2010 14:46:27 +0000 (14:46 +0000)
tos/platforms/shimmer/Time.nc
tos/platforms/shimmer/TimeP.nc

index 76e2a01134b3d12784ee9432aa26628f1e4f3580..530d66a6897e7d0055cab186f13ead7800f469a0 100644 (file)
@@ -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();
 }
index 5340939125a0d95d0a5caf3b71ff54d482f561d5..4aa2b981512d0b2d2a0b5a28160c5579fbda25b0 100644 (file)
@@ -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)) {