aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llcommon/lltimer.h
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llcommon/lltimer.h')
-rw-r--r--linden/indra/llcommon/lltimer.h37
1 files changed, 33 insertions, 4 deletions
diff --git a/linden/indra/llcommon/lltimer.h b/linden/indra/llcommon/lltimer.h
index 91b93d6..8d94276 100644
--- a/linden/indra/llcommon/lltimer.h
+++ b/linden/indra/llcommon/lltimer.h
@@ -35,6 +35,7 @@
35#if LL_LINUX || LL_DARWIN 35#if LL_LINUX || LL_DARWIN
36#include <sys/time.h> 36#include <sys/time.h>
37#endif 37#endif
38#include <limits.h>
38 39
39#include "stdtypes.h" 40#include "stdtypes.h"
40 41
@@ -117,7 +118,35 @@ void ms_sleep(U32 ms);
117 118
118// Returns the correct UTC time in seconds, like time(NULL). 119// Returns the correct UTC time in seconds, like time(NULL).
119// Useful on the viewer, which may have its local clock set wrong. 120// Useful on the viewer, which may have its local clock set wrong.
120U32 time_corrected(); 121time_t time_corrected();
122
123static inline time_t time_min()
124{
125 if (sizeof(time_t) == 4)
126 {
127 return (time_t) INT_MIN;
128 } else {
129#ifdef LLONG_MIN
130 return (time_t) LLONG_MIN;
131#else
132 return (time_t) LONG_MIN;
133#endif
134 }
135}
136
137static inline time_t time_max()
138{
139 if (sizeof(time_t) == 4)
140 {
141 return (time_t) INT_MAX;
142 } else {
143#ifdef LLONG_MAX
144 return (time_t) LLONG_MAX;
145#else
146 return (time_t) LONG_MAX;
147#endif
148 }
149}
121 150
122// Correction factor used by time_corrected() above. 151// Correction factor used by time_corrected() above.
123extern S32 gUTCOffset; 152extern S32 gUTCOffset;
@@ -131,10 +160,10 @@ BOOL is_daylight_savings();
131// S32 utc_time; 160// S32 utc_time;
132// utc_time = time_corrected(); 161// utc_time = time_corrected();
133// struct tm* internal_time = utc_to_pacific_time(utc_time, gDaylight); 162// struct tm* internal_time = utc_to_pacific_time(utc_time, gDaylight);
134struct tm* utc_to_pacific_time(S32 utc_time, BOOL pacific_daylight_time); 163struct tm* utc_to_pacific_time(time_t utc_time, BOOL pacific_daylight_time);
135 164
136void microsecondsToTimecodeString(U64 current_time, char *tcstring); 165void microsecondsToTimecodeString(U64 current_time, std::string& tcstring);
137void secondsToTimecodeString(F32 current_time, char *tcstring); 166void secondsToTimecodeString(F32 current_time, std::string& tcstring);
138 167
139// class for scheduling a function to be called at a given frequency (approximate, inprecise) 168// class for scheduling a function to be called at a given frequency (approximate, inprecise)
140class LLEventTimer 169class LLEventTimer