Cygwin: Cleanup time handling

* Redefine NSPERSEC to NS100PERSEC
* Define NSPERSEC as nanosecs per second
* Define USPERSEC as microsecs per second
* Use above constants throughout where appropriate
* Rename to_us to timespec_to_us and inline
* Rename it_bad to timespec_bad and inline

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen
2018-02-07 13:07:44 +01:00
parent f8ce691223
commit 2af67d21b2
13 changed files with 115 additions and 97 deletions

View File

@@ -12,8 +12,10 @@
#include "miscfuncs.h"
#include "cygerrno.h"
#include "pinfo.h"
#include "hires.h"
/* for getpid */
#include <unistd.h>
#include <sys/param.h>
#include "registry.h"
/* Win32 priority to UNIX priority Mapping. */
@@ -199,9 +201,9 @@ sched_rr_get_interval (pid_t pid, struct timespec *interval)
slindex -= 1;
nsec = quantable[vfindex][slindex][qindex] / quantapertick
* clocktickinterval * 1000000;
interval->tv_sec = nsec / 1000000000;
interval->tv_nsec = nsec % 1000000000;
* clocktickinterval * (NSPERSEC / HZ);
interval->tv_sec = nsec / NSPERSEC;
interval->tv_nsec = nsec % NSPERSEC;
return 0;
}