Disable timer_minutes() for targets with 16bit time_t.
authorbernie <bernie@38d2e660-2303-0410-9eaa-f027e97ec537>
Tue, 16 Nov 2004 23:09:52 +0000 (23:09 +0000)
committerbernie <bernie@38d2e660-2303-0410-9eaa-f027e97ec537>
Tue, 16 Nov 2004 23:09:52 +0000 (23:09 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@287 38d2e660-2303-0410-9eaa-f027e97ec537

drv/timer.h

index bcf1ac9d14d9ecde1c6020da3d722a123870fb88..bb8c89dda02c34ce168e6cc7bbb937752528236e 100755 (executable)
@@ -15,6 +15,9 @@
 
 /*#*
  *#* $Log$
+ *#* Revision 1.18  2004/11/16 23:09:52  bernie
+ *#* Disable timer_minutes() for targets with 16bit time_t.
+ *#*
  *#* Revision 1.17  2004/11/16 22:37:14  bernie
  *#* Replace IPTR with iptr_t.
  *#*
@@ -84,7 +87,7 @@ extern void timer_udelay(utime_t utime);
 
 #ifndef CONFIG_TIMER_DISABLE_EVENTS
 
-#ifdef CONFIG_KERNEL
+#if CONFIG_KERNEL
        #include <kern/event.h>
 #else
        #include <mware/event.h>
@@ -184,16 +187,25 @@ INLINE time_t timer_ticks_unlocked(void)
 }
 
 
+/*
+ * timer_minutes() makes no sense when time_t is 16bit because
+ * it overflows every 65.536 seconds.
+ */
+#if SIZEOF_TIME_T >= 4
+
 /*!
  * Return the minutes passed since timer start.
  *
- * The uptime in minutes is computed directly from system tick counter.
- * This value wraps around every 71582 minutes with a 32bit time_t.
+ * The minutes uptime is computed directly from system tick counter:
+ * in case of a 4 bytes time_t after 71582 minutes the value will
+ * wrap around.
  */
 INLINE time_t timer_minutes(void)
 {
        return timer_ticks() / (TICKS_PER_SEC * 60);
 }
 
+#endif /* SIZEOF_TIME_T >= 4 */
+
 #endif /* DRV_TIMER_H */