50 lines
1.3 KiB
C
50 lines
1.3 KiB
C
/* $TOG: usleep.c /main/6 1998/04/06 13:32:38 mgreess $ */
|
|
/*
|
|
*/
|
|
/* *
|
|
* (c) Copyright 1993, 1994 Hewlett-Packard Company *
|
|
* (c) Copyright 1993, 1994 International Business Machines Corp. *
|
|
* (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
|
|
* (c) Copyright 1993, 1994 Novell, Inc. *
|
|
*/
|
|
/*-
|
|
* usleep.c - OS dependant implementation of usleep().
|
|
*
|
|
* Copyright (c) 1991 by Patrick J. Naughton.
|
|
*
|
|
* Revision History:
|
|
* 30-Aug-90: written.
|
|
*
|
|
*/
|
|
|
|
#include "dtscreen.h"
|
|
|
|
#if !defined(_AIX) && !defined(hpV4) && !defined(linux)
|
|
int
|
|
usleep(unsigned long usec)
|
|
{
|
|
#ifdef SYSV
|
|
poll((struct poll *) 0, (size_t) 0, usec / 1000); /* ms resolution */
|
|
#else
|
|
struct timeval timeout;
|
|
timeout.tv_usec = usec % (unsigned long) 1000000;
|
|
timeout.tv_sec = usec / (unsigned long) 1000000;
|
|
select(0, (void *) 0, (void *) 0, (void *) 0, &timeout);
|
|
#endif
|
|
return 0;
|
|
}
|
|
#endif /* !_AIX && !hpV4*/
|
|
|
|
/*
|
|
* returns the number of seconds since 01-Jan-70.
|
|
* This is used to control rate and timeout in many of the animations.
|
|
*/
|
|
long
|
|
seconds()
|
|
{
|
|
struct timeval now;
|
|
|
|
gettimeofday(&now, (struct timezone *) 0);
|
|
return now.tv_sec;
|
|
}
|