s/G_MICROSEC/G_USEC_PER_SEC/

2000-09-06  Sebastian Wilhelmi  <wilhelmi@ira.uka.de>

	* glib.h, gtimer.c, tests/thread-test.c:
	s/G_MICROSEC/G_USEC_PER_SEC/

	* gthread/gthread-posix.c, gthread/gthread-solaris.c:
	s/G_MICROSEC/G_USEC_PER_SEC/ and s/G_NANOSEC/G_NSEC_PER_SEC/
This commit is contained in:
Sebastian Wilhelmi 2000-09-06 13:56:17 +00:00 committed by Sebastian Wilhelmi
parent caeb4053e9
commit ef2dcd6265
16 changed files with 59 additions and 30 deletions

View File

@ -1,5 +1,8 @@
2000-09-06 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* 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.

View File

@ -1,5 +1,8 @@
2000-09-06 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* 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.

View File

@ -1,5 +1,8 @@
2000-09-06 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* 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.

View File

@ -1,5 +1,8 @@
2000-09-06 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* 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.

View File

@ -1,5 +1,8 @@
2000-09-06 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* 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.

View File

@ -1,5 +1,8 @@
2000-09-06 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* 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.

View File

@ -1,5 +1,8 @@
2000-09-06 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* 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.

View File

@ -1,5 +1,8 @@
2000-09-06 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* 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.

3
glib.h
View File

@ -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);

View File

@ -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);

View File

@ -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

View File

@ -1,3 +1,8 @@
2000-09-06 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* 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 <wilhelmi@ira.uka.de>
* gthread-posix.c (g_thread_create_posix_impl): Use GError to

View File

@ -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);

View File

@ -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);

View File

@ -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

View File

@ -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++)
{