GNUNET_TIME_set_offset (long long offset);
+/**
+ * Get the timestamp offset for this instance.
+ *
+ * @return the offset we currently skew the locale time by
+ */
+long long
+GNUNET_TIME_get_offset (void);
+
+
#if 0 /* keep Emacsens' auto-indent happy */
{
#endif
memset (date, 0, DATE_STR_SIZE);
{
char buf[size];
+ long long offset;
#ifdef WINDOWS
LARGE_INTEGER pc;
time_t timetmp;
+ offset = GNUNET_TIME_get_offset ();
time (&timetmp);
+ timetmp += offset / 1000;
tmptr = localtime (&timetmp);
pc.QuadPart = 0;
QueryPerformanceCounter (&pc);
struct timeval timeofday;
gettimeofday (&timeofday, NULL);
+ offset = GNUNET_TIME_get_offset ();
+ if (offset > 0)
+ {
+ timeofday.tv_sec += offset / 1000LL;
+ timeofday.tv_usec += (offset % 1000LL) * 1000LL;
+ if (timeofday.tv_usec > 1000000LL)
+ {
+ timeofday.tv_usec -= 1000000LL;
+ timeofday.tv_sec++;
+ }
+ }
+ else
+ {
+ timeofday.tv_sec += offset / 1000LL;
+ if (timeofday.tv_usec > - (offset % 1000LL) * 1000LL)
+ {
+ timeofday.tv_usec += (offset % 1000LL) * 1000LL;
+ }
+ else
+ {
+ timeofday.tv_usec += 1000000LL + (offset % 1000LL) * 1000LL;
+ timeofday.tv_sec--;
+ }
+ }
tmptr = localtime (&timeofday.tv_sec);
if (NULL == tmptr)
{
}
+/**
+ * Get the timestamp offset for this instance.
+ *
+ * @return the offset we currently skew the locale time by
+ */
+long long
+GNUNET_TIME_get_offset ()
+{
+ return timestamp_offset;
+}
+
+
/**
* Get the current time (works just as "time", just that we use the
* unit of time that the cron-jobs use (and is 64 bit)).