diff --git a/ChangeLog b/ChangeLog index 108f58315..7d401b41b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2000-09-06 Sebastian Wilhelmi + * glib.h, gtimer.c, tests/thread-test.c: + s/G_MICROSEC/G_USEC_PER_SEC/ + * glib.h: Removed G_G{U}{SHORT|INT|LONG}_FORMAT from glib.h, as they are really superfluous. diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 108f58315..7d401b41b 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,5 +1,8 @@ 2000-09-06 Sebastian Wilhelmi + * glib.h, gtimer.c, tests/thread-test.c: + s/G_MICROSEC/G_USEC_PER_SEC/ + * glib.h: Removed G_G{U}{SHORT|INT|LONG}_FORMAT from glib.h, as they are really superfluous. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 108f58315..7d401b41b 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,5 +1,8 @@ 2000-09-06 Sebastian Wilhelmi + * glib.h, gtimer.c, tests/thread-test.c: + s/G_MICROSEC/G_USEC_PER_SEC/ + * glib.h: Removed G_G{U}{SHORT|INT|LONG}_FORMAT from glib.h, as they are really superfluous. diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index 108f58315..7d401b41b 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,5 +1,8 @@ 2000-09-06 Sebastian Wilhelmi + * glib.h, gtimer.c, tests/thread-test.c: + s/G_MICROSEC/G_USEC_PER_SEC/ + * glib.h: Removed G_G{U}{SHORT|INT|LONG}_FORMAT from glib.h, as they are really superfluous. diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 108f58315..7d401b41b 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,5 +1,8 @@ 2000-09-06 Sebastian Wilhelmi + * glib.h, gtimer.c, tests/thread-test.c: + s/G_MICROSEC/G_USEC_PER_SEC/ + * glib.h: Removed G_G{U}{SHORT|INT|LONG}_FORMAT from glib.h, as they are really superfluous. diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 108f58315..7d401b41b 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,5 +1,8 @@ 2000-09-06 Sebastian Wilhelmi + * glib.h, gtimer.c, tests/thread-test.c: + s/G_MICROSEC/G_USEC_PER_SEC/ + * glib.h: Removed G_G{U}{SHORT|INT|LONG}_FORMAT from glib.h, as they are really superfluous. diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 108f58315..7d401b41b 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,5 +1,8 @@ 2000-09-06 Sebastian Wilhelmi + * glib.h, gtimer.c, tests/thread-test.c: + s/G_MICROSEC/G_USEC_PER_SEC/ + * glib.h: Removed G_G{U}{SHORT|INT|LONG}_FORMAT from glib.h, as they are really superfluous. diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 108f58315..7d401b41b 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,5 +1,8 @@ 2000-09-06 Sebastian Wilhelmi + * glib.h, gtimer.c, tests/thread-test.c: + s/G_MICROSEC/G_USEC_PER_SEC/ + * glib.h: Removed G_G{U}{SHORT|INT|LONG}_FORMAT from glib.h, as they are really superfluous. diff --git a/glib.h b/glib.h index 521cb8ff2..3206d59d6 100644 --- a/glib.h +++ b/glib.h @@ -1636,7 +1636,8 @@ void g_blow_chunks (void); /* Timer */ -#define G_MICROSEC 1000000 +/* microseconds per second */ +#define G_USEC_PER_SEC 1000000 GTimer* g_timer_new (void); void g_timer_destroy (GTimer *timer); diff --git a/glib/glib.h b/glib/glib.h index 521cb8ff2..3206d59d6 100644 --- a/glib/glib.h +++ b/glib/glib.h @@ -1636,7 +1636,8 @@ void g_blow_chunks (void); /* Timer */ -#define G_MICROSEC 1000000 +/* microseconds per second */ +#define G_USEC_PER_SEC 1000000 GTimer* g_timer_new (void); void g_timer_destroy (GTimer *timer); diff --git a/glib/gtimer.c b/glib/gtimer.c index 5309ffffa..299d638c8 100644 --- a/glib/gtimer.c +++ b/glib/gtimer.c @@ -176,7 +176,7 @@ g_timer_elapsed (GTimer *timer, if (rtimer->start.tv_usec > rtimer->end.tv_usec) { - rtimer->end.tv_usec += G_MICROSEC; + rtimer->end.tv_usec += G_USEC_PER_SEC; rtimer->end.tv_sec--; } @@ -213,12 +213,12 @@ g_usleep (gulong microseconds) g_get_current_time (&end_time); - end_time.tv_sec += microseconds / G_MICROSEC; - end_time.tv_usec += microseconds % G_MICROSEC; + end_time.tv_sec += microseconds / G_USEC_PER_SEC; + end_time.tv_usec += microseconds % G_USEC_PER_SEC; - if (end_time.tv_usec >= G_MICROSEC) + if (end_time.tv_usec >= G_USEC_PER_SEC) { - end_time.tv_usec -= G_MICROSEC; + end_time.tv_usec -= G_USEC_PER_SEC; end_time.tv_sec += 1; } @@ -236,8 +236,8 @@ g_usleep (gulong microseconds) else { struct timeval tv; - tv.tv_sec = microseconds / G_MICROSEC; - tv.tv_usec = microseconds % G_MICROSEC; + tv.tv_sec = microseconds / G_USEC_PER_SEC; + tv.tv_usec = microseconds % G_USEC_PER_SEC; select(0, NULL, NULL, NULL, &tv); } #endif diff --git a/gthread/ChangeLog b/gthread/ChangeLog index 4a35bfa12..7abe93c3a 100644 --- a/gthread/ChangeLog +++ b/gthread/ChangeLog @@ -1,3 +1,8 @@ +2000-09-06 Sebastian Wilhelmi + + * gthread-posix.c, gthread-solaris.c: + s/G_MICROSEC/G_USEC_PER_SEC/ and s/G_NANOSEC/G_NSEC_PER_SEC/ + 2000-09-01 Sebastian Wilhelmi * gthread-posix.c (g_thread_create_posix_impl): Use GError to diff --git a/gthread/gthread-posix.c b/gthread/gthread-posix.c index 5516a2964..bae02f10c 100644 --- a/gthread/gthread-posix.c +++ b/gthread/gthread-posix.c @@ -142,8 +142,7 @@ g_cond_new_posix_impl (void) without error check then!!!!, we might want to change this therfore. */ -#define G_MICROSEC 1000000 -#define G_NANOSEC 1000000000 +#define G_NSEC_PER_SEC 1000000000 static gboolean g_cond_timed_wait_posix_impl (GCond * cond, @@ -164,8 +163,8 @@ g_cond_timed_wait_posix_impl (GCond * cond, } end_time.tv_sec = abs_time->tv_sec; - end_time.tv_nsec = abs_time->tv_usec * (G_NANOSEC / G_MICROSEC); - g_assert (end_time.tv_nsec < G_NANOSEC); + end_time.tv_nsec = abs_time->tv_usec * (G_NSEC_PER_SEC / G_USEC_PER_SEC); + g_assert (end_time.tv_nsec < G_NSEC_PER_SEC); result = pthread_cond_timedwait ((pthread_cond_t *) cond, (pthread_mutex_t *) entered_mutex, &end_time); diff --git a/gthread/gthread-solaris.c b/gthread/gthread-solaris.c index 7cf3c6ff0..99e5ee97a 100644 --- a/gthread/gthread-solaris.c +++ b/gthread/gthread-solaris.c @@ -108,8 +108,7 @@ g_cond_new_solaris_impl () without error check then!!!!, we might want to change this therfore. */ -#define G_MICROSEC 1000000 -#define G_NANOSEC 1000000000 +#define G_NSEC_PER_SEC 1000000000 static gboolean g_cond_timed_wait_solaris_impl (GCond * cond, @@ -130,8 +129,8 @@ g_cond_timed_wait_solaris_impl (GCond * cond, } end_time.tv_sec = abs_time->tv_sec; - end_time.tv_nsec = abs_time->tv_usec * (G_NANOSEC / G_MICROSEC); - g_assert (end_time.tv_nsec < G_NANOSEC); + end_time.tv_nsec = abs_time->tv_usec * (G_NSEC_PER_SEC / G_USEC_PER_SEC); + g_assert (end_time.tv_nsec < G_NSEC_PER_SEC); result = cond_timedwait ((cond_t *) cond, (mutex_t *) entered_mutex, &end_time); timed_out = (result == ETIME); diff --git a/gtimer.c b/gtimer.c index 5309ffffa..299d638c8 100644 --- a/gtimer.c +++ b/gtimer.c @@ -176,7 +176,7 @@ g_timer_elapsed (GTimer *timer, if (rtimer->start.tv_usec > rtimer->end.tv_usec) { - rtimer->end.tv_usec += G_MICROSEC; + rtimer->end.tv_usec += G_USEC_PER_SEC; rtimer->end.tv_sec--; } @@ -213,12 +213,12 @@ g_usleep (gulong microseconds) g_get_current_time (&end_time); - end_time.tv_sec += microseconds / G_MICROSEC; - end_time.tv_usec += microseconds % G_MICROSEC; + end_time.tv_sec += microseconds / G_USEC_PER_SEC; + end_time.tv_usec += microseconds % G_USEC_PER_SEC; - if (end_time.tv_usec >= G_MICROSEC) + if (end_time.tv_usec >= G_USEC_PER_SEC) { - end_time.tv_usec -= G_MICROSEC; + end_time.tv_usec -= G_USEC_PER_SEC; end_time.tv_sec += 1; } @@ -236,8 +236,8 @@ g_usleep (gulong microseconds) else { struct timeval tv; - tv.tv_sec = microseconds / G_MICROSEC; - tv.tv_usec = microseconds % G_MICROSEC; + tv.tv_sec = microseconds / G_USEC_PER_SEC; + tv.tv_usec = microseconds % G_USEC_PER_SEC; select(0, NULL, NULL, NULL, &tv); } #endif diff --git a/tests/thread-test.c b/tests/thread-test.c index 1316982a8..1fc6b8365 100644 --- a/tests/thread-test.c +++ b/tests/thread-test.c @@ -28,7 +28,7 @@ test_g_mutex (void) thread = g_thread_create (test_g_mutex_thread, GINT_TO_POINTER (42), 0, TRUE, TRUE, G_THREAD_PRIORITY_NORMAL, NULL); - g_usleep (G_MICROSEC); + g_usleep (G_USEC_PER_SEC); test_g_mutex_int = 42; G_UNLOCK (test_g_mutex); g_mutex_unlock (test_g_mutex_mutex); @@ -63,14 +63,14 @@ test_g_static_rec_mutex (void) thread = g_thread_create (test_g_static_rec_mutex_thread, GINT_TO_POINTER (42), 0, TRUE, TRUE, G_THREAD_PRIORITY_NORMAL, NULL); - g_usleep (G_MICROSEC); + g_usleep (G_USEC_PER_SEC); g_assert (g_static_rec_mutex_trylock (&test_g_static_rec_mutex_mutex)); - g_usleep (G_MICROSEC); + g_usleep (G_USEC_PER_SEC); test_g_static_rec_mutex_int = 41; g_static_rec_mutex_unlock (&test_g_static_rec_mutex_mutex); test_g_static_rec_mutex_int = 42; g_static_rec_mutex_unlock (&test_g_static_rec_mutex_mutex); - g_usleep (G_MICROSEC); + g_usleep (G_USEC_PER_SEC); g_static_rec_mutex_lock (&test_g_static_rec_mutex_mutex); test_g_static_rec_mutex_int = 0; g_static_rec_mutex_unlock (&test_g_static_rec_mutex_mutex); @@ -121,7 +121,7 @@ test_g_static_private_thread (gpointer data) test_g_static_private_destructor); } *private = number; - g_usleep (G_MICROSEC / 5); + g_usleep (G_USEC_PER_SEC / 5); g_assert (number == *private); } } @@ -215,7 +215,7 @@ test_g_static_rw_lock () 0, 0, TRUE, TRUE, G_THREAD_PRIORITY_NORMAL, NULL); } - g_usleep (G_MICROSEC); + g_usleep (G_USEC_PER_SEC); test_g_static_rw_lock_run = FALSE; for (i = 0; i < THREADS; i++) {