aboutsummaryrefslogtreecommitdiffstats
path: root/extension/time.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2013-02-11 20:56:07 +0200
committerArnold D. Robbins <arnold@skeeve.com>2013-02-11 20:56:07 +0200
commit0c0982740c0afda6ec893e6fcd361533033331f4 (patch)
treef1d443122f401456140b2d3f493c8d0d10248530 /extension/time.c
parentba18cde06b1c80426fdc9d5e6dff793d44bb0bc8 (diff)
downloadegawk-0c0982740c0afda6ec893e6fcd361533033331f4.tar.gz
egawk-0c0982740c0afda6ec893e6fcd361533033331f4.tar.bz2
egawk-0c0982740c0afda6ec893e6fcd361533033331f4.zip
Fixes to extensions for Win 32.
Diffstat (limited to 'extension/time.c')
-rw-r--r--extension/time.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/extension/time.c b/extension/time.c
index 89811c41..dcafb8fa 100644
--- a/extension/time.c
+++ b/extension/time.c
@@ -61,6 +61,9 @@ int plugin_is_GPL_compatible;
#if defined(HAVE_NANOSLEEP) && defined(HAVE_TIME_H)
#include <time.h>
#endif
+#if defined(HAVE_GETSYSTEMTIMEASFILETIME)
+#include <windows.h>
+#endif
/*
* Returns time since 1/1/1970 UTC as a floating point value; should
@@ -160,10 +163,17 @@ do_sleep(int nargs, awk_value_t *result)
/* probably interrupted */
update_ERRNO_int(errno);
}
+#elif defined(HAVE_GETSYSTEMTIMEASFILETIME)
+ {
+ DWORD milliseconds = secs * 1000;
+
+ Sleep (milliseconds);
+ rc = 0;
+ }
#else
/* no way to sleep on this platform */
rc = -1;
- update_ERRNO_str(_("sleep: not supported on this platform"));
+ update_ERRNO_string(_("sleep: not supported on this platform"));
#endif
return make_number(rc, result);