Cygwin: timers: Simplify hires_ms and hires_ns
Drop hires_base and move inited into hires_ns. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
parent
a094c5bafa
commit
65091f0f35
|
@ -38,16 +38,9 @@ details. */
|
||||||
/* # of millisecs per second. */
|
/* # of millisecs per second. */
|
||||||
#define MSPERSEC (1000L)
|
#define MSPERSEC (1000L)
|
||||||
|
|
||||||
class hires_base
|
class hires_ns
|
||||||
{
|
{
|
||||||
protected:
|
|
||||||
int inited;
|
int inited;
|
||||||
public:
|
|
||||||
void reset() {inited = false;}
|
|
||||||
};
|
|
||||||
|
|
||||||
class hires_ns : public hires_base
|
|
||||||
{
|
|
||||||
LARGE_INTEGER primed_pc;
|
LARGE_INTEGER primed_pc;
|
||||||
double freq;
|
double freq;
|
||||||
void prime ();
|
void prime ();
|
||||||
|
@ -57,7 +50,7 @@ class hires_ns : public hires_base
|
||||||
LONGLONG resolution();
|
LONGLONG resolution();
|
||||||
};
|
};
|
||||||
|
|
||||||
class hires_ms : public hires_base
|
class hires_ms
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LONGLONG nsecs ();
|
LONGLONG nsecs ();
|
||||||
|
|
|
@ -120,8 +120,6 @@ settimeofday (const struct timeval *tv, const struct timezone *tz)
|
||||||
st.wMilliseconds = tv->tv_usec / (USPERSEC / MSPERSEC);
|
st.wMilliseconds = tv->tv_usec / (USPERSEC / MSPERSEC);
|
||||||
|
|
||||||
res = -!SetSystemTime (&st);
|
res = -!SetSystemTime (&st);
|
||||||
gtod.reset ();
|
|
||||||
|
|
||||||
if (res)
|
if (res)
|
||||||
set_errno (EPERM);
|
set_errno (EPERM);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue