X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;ds=sidebyside;f=cbits%2FWin32Utils.c;h=fd4d1eb0ef46b613727cc2547a0fe8541147653f;hb=a4f3f0790c84739ab08ee0e41a4b7a7132cdba0b;hp=942b2c47a3ac9fe12e0a1b74265bed0ee02b6add;hpb=1d4ff287d9057348f811d8d447a321ad617ecfdf;p=ghc-base.git diff --git a/cbits/Win32Utils.c b/cbits/Win32Utils.c index 942b2c4..fd4d1eb 100644 --- a/cbits/Win32Utils.c +++ b/cbits/Win32Utils.c @@ -61,7 +61,10 @@ static struct errentry errtable[] = { { ERROR_ALREADY_EXISTS, EEXIST }, /* 183 */ { ERROR_FILENAME_EXCED_RANGE, ENOENT }, /* 206 */ { ERROR_NESTING_NOT_ALLOWED, EAGAIN }, /* 215 */ - { ERROR_NOT_ENOUGH_QUOTA, ENOMEM } /* 1816 */ + /* Windows returns this when the read end of a pipe is + * closed (or closing) and we write to it. */ + { ERROR_NO_DATA, EPIPE }, /* 232 */ + { ERROR_NOT_ENOUGH_QUOTA, ENOMEM } /* 1816 */ }; /* size of the table */ @@ -107,18 +110,16 @@ void maperrno (void) errno = EINVAL; } -#define TICKS_PER_SECOND 50 -// must match GHC.Conc.tick_freq - -HsInt getTicksOfDay(void) +HsWord64 getUSecOfDay(void) { - HsInt64 t; + HsWord64 t; FILETIME ft; GetSystemTimeAsFileTime(&ft); - t = ((HsInt64)ft.dwHighDateTime << 32) | ft.dwLowDateTime; - t = (t * TICKS_PER_SECOND) / 10000000LL; - /* FILETIMES are in units of 100ns */ - return (HsInt)t; + t = ((HsWord64)ft.dwHighDateTime << 32) | ft.dwLowDateTime; + t = t / 10LL; + /* FILETIMES are in units of 100ns, + so we divide by 10 to get microseconds */ + return t; } #endif