Commit 4ecd1220 authored by Pekka Pessi's avatar Pekka Pessi

su/su_time0.c: fixed whitespace

darcs-hash:20081127130719-db55f-bdd89fd760f38436056aff28d79f5bd6e3b32623.gz
parent cec2d547
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
* *
* @author Pekka Pessi <Pekka.Pessi@nokia.com> * @author Pekka Pessi <Pekka.Pessi@nokia.com>
* @author Jari Selin <Jari.Selin@nokia.com> * @author Jari Selin <Jari.Selin@nokia.com>
* *
* @date Created: Fri May 10 18:13:19 2002 ppessi * @date Created: Fri May 10 18:13:19 2002 ppessi
*/ */
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
#endif #endif
/** Seconds from 1.1.1900 to 1.1.1970 */ /** Seconds from 1.1.1900 to 1.1.1970 */
#define NTP_EPOCH 2208988800UL #define NTP_EPOCH 2208988800UL
#define E9 (1000000000U) #define E9 (1000000000U)
#define E7 (10000000U) #define E7 (10000000U)
...@@ -92,7 +92,7 @@ void su_time(su_time_t *tv) ...@@ -92,7 +92,7 @@ void su_time(su_time_t *tv)
GetSystemTimeAsFileTime(date.ft); GetSystemTimeAsFileTime(date.ft);
tv->tv_usec = (unsigned long) ((date.ull->QuadPart % E7) / 10); tv->tv_usec = (unsigned long) ((date.ull->QuadPart % E7) / 10);
tv->tv_sec = (unsigned long) ((date.ull->QuadPart / E7) - tv->tv_sec = (unsigned long) ((date.ull->QuadPart / E7) -
/* 1900-Jan-01 - 1601-Jan-01: 299 years, 72 leap years */ /* 1900-Jan-01 - 1601-Jan-01: 299 years, 72 leap years */
(299 * 365 + 72) * 24 * 60 * (uint64_t)60); (299 * 365 + 72) * 24 * 60 * (uint64_t)60);
#else #else
...@@ -122,7 +122,7 @@ su_nanotime_t su_nanotime(su_nanotime_t *return_time) ...@@ -122,7 +122,7 @@ su_nanotime_t su_nanotime(su_nanotime_t *return_time)
#if HAVE_CLOCK_GETTIME #if HAVE_CLOCK_GETTIME
{ {
struct timespec tv; struct timespec tv;
if (clock_gettime(CLOCK_REALTIME, &tv) == 0) { if (clock_gettime(CLOCK_REALTIME, &tv) == 0) {
now = ((su_nanotime_t)tv.tv_sec + NTP_EPOCH) * E9 + tv.tv_nsec; now = ((su_nanotime_t)tv.tv_sec + NTP_EPOCH) * E9 + tv.tv_nsec;
*return_time = now; *return_time = now;
...@@ -139,11 +139,11 @@ su_nanotime_t su_nanotime(su_nanotime_t *return_time) ...@@ -139,11 +139,11 @@ su_nanotime_t su_nanotime(su_nanotime_t *return_time)
FILETIME ft[1]; FILETIME ft[1];
ULARGE_INTEGER ull[1]; ULARGE_INTEGER ull[1];
} date; } date;
GetSystemTimeAsFileTime(date.ft); GetSystemTimeAsFileTime(date.ft);
now = 100 * now = 100 *
(date.ull->QuadPart - (date.ull->QuadPart -
/* 1900-Jan-01 - 1601-Jan-01: 299 years, 72 leap years */ /* 1900-Jan-01 - 1601-Jan-01: 299 years, 72 leap years */
((su_nanotime_t)(299 * 365 + 72) * 24 * 60 * 60) * E7); ((su_nanotime_t)(299 * 365 + 72) * 24 * 60 * 60) * E7);
} }
...@@ -173,16 +173,16 @@ su_nanotime_t su_nanotime(su_nanotime_t *return_time) ...@@ -173,16 +173,16 @@ su_nanotime_t su_nanotime(su_nanotime_t *return_time)
* monotonic and never goes back - if the underlying system supports such a * monotonic and never goes back - if the underlying system supports such a
* clock. * clock.
* *
* @param return_time optional pointer to return the current time * @param return_time optional pointer to return the current time
* *
* @return Current time as nanoseconds * @return Current time as nanoseconds
*/ */
su_nanotime_t su_monotime(su_nanotime_t *return_time) su_nanotime_t su_monotime(su_nanotime_t *return_time)
{ {
#if HAVE_CLOCK_GETTIME && CLOCK_MONOTONIC #if HAVE_CLOCK_GETTIME && CLOCK_MONOTONIC
{ {
struct timespec tv; struct timespec tv;
if (clock_gettime(CLOCK_MONOTONIC, &tv) == 0) { if (clock_gettime(CLOCK_MONOTONIC, &tv) == 0) {
su_nanotime_t now = (su_nanotime_t)tv.tv_sec * E9 + tv.tv_nsec; su_nanotime_t now = (su_nanotime_t)tv.tv_sec * E9 + tv.tv_nsec;
if (return_time) if (return_time)
...@@ -195,7 +195,7 @@ su_nanotime_t su_monotime(su_nanotime_t *return_time) ...@@ -195,7 +195,7 @@ su_nanotime_t su_monotime(su_nanotime_t *return_time)
#if HAVE_NANOUPTIME #if HAVE_NANOUPTIME
{ {
struct timespec tv; struct timespec tv;
nanouptime(&tv); nanouptime(&tv);
now = (su_nanotime_t)tv.tv_sec * E9 + tv.tv_nsec; now = (su_nanotime_t)tv.tv_sec * E9 + tv.tv_nsec;
if (return_time) if (return_time)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment