From dad5f25058c4ecf69ebe4543a13281d3f28c69bc Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Mon, 30 Dec 2013 21:52:45 +0200 Subject: Build and test dynamic extensions on VMS. Documented too. --- extension/time.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'extension/time.c') diff --git a/extension/time.c b/extension/time.c index 9fadfe54..b1e9a40a 100644 --- a/extension/time.c +++ b/extension/time.c @@ -39,6 +39,30 @@ #include #include +#ifdef __VMS +#define HAVE_NANOSLEEP +#define HAVE_GETTIMEOFDAY +#ifdef gettimeofday +#undef gettimeofday +#endif +#ifdef __ia64__ +/* nanosleep not working on IA64 */ +static int +vms_fake_nanosleep(const struct timespec *rqdly, struct timespec *rmdly) +{ + int result; + + result = sleep(rqdly->tv_sec); + if (result == 0) { + return 0; + } else { + return -1; + } +} +#define nanosleep(x,y) vms_fake_nanosleep(x, y) +#endif +#endif + #include "gawkapi.h" #include "gettext.h" -- cgit v1.2.3 From a6131306dd49537de45afdfdc6d4ad2dcac7655b Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Fri, 14 Feb 2014 13:22:51 +0200 Subject: VMS updates. --- extension/time.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) (limited to 'extension/time.c') diff --git a/extension/time.c b/extension/time.c index b1e9a40a..c336df88 100644 --- a/extension/time.c +++ b/extension/time.c @@ -1,25 +1,24 @@ /* * time.c - Builtin functions that provide time-related functions. - * */ /* * Copyright (C) 2012, 2013 * the Free Software Foundation, Inc. - * + * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. - * + * * GAWK is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * GAWK is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA @@ -46,18 +45,28 @@ #undef gettimeofday #endif #ifdef __ia64__ -/* nanosleep not working on IA64 */ +/* nanosleep not working correctly on IA64 */ static int -vms_fake_nanosleep(const struct timespec *rqdly, struct timespec *rmdly) +vms_fake_nanosleep(struct timespec *rqdly, struct timespec *rmdly) { int result; + struct timespec mtime1, mtime2; - result = sleep(rqdly->tv_sec); - if (result == 0) { + result = nanosleep(rqdly, &mtime1); + if (result == 0) return 0; - } else { - return -1; + + /* On IA64 it returns 100 nanoseconds early with an error */ + if ((mtime1.tv_sec == 0) && (mtime1.tv_nsec <= 100)) { + mtime1.tv_nsec += 100; + result = nanosleep(&mtime1, &mtime2); + if (result == 0) + return 0; + if ((mtime2.tv_sec == 0) && (mtime2.tv_nsec <= 100)) { + return 0; + } } + return result; } #define nanosleep(x,y) vms_fake_nanosleep(x, y) #endif -- cgit v1.2.3 From 69d85d51dfd0f2e3b464585633d270f06fa1e846 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Mon, 31 Mar 2014 22:17:13 +0300 Subject: Update copyright years on files changed in 2014. --- extension/time.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'extension/time.c') diff --git a/extension/time.c b/extension/time.c index c336df88..19466e08 100644 --- a/extension/time.c +++ b/extension/time.c @@ -3,7 +3,7 @@ */ /* - * Copyright (C) 2012, 2013 + * Copyright (C) 2012, 2013, 2014 * the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the -- cgit v1.2.3 From 396767664c93e58b106e000dd52fd973c8b5b273 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Fri, 4 Apr 2014 11:43:07 +0300 Subject: Fix a compilation warning. --- extension/time.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'extension/time.c') diff --git a/extension/time.c b/extension/time.c index 19466e08..e6b2b39f 100644 --- a/extension/time.c +++ b/extension/time.c @@ -85,15 +85,13 @@ static awk_bool_t (*init_func)(void) = NULL; int plugin_is_GPL_compatible; +#include #if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H) #include #endif #if defined(HAVE_SELECT) && defined(HAVE_SYS_SELECT_H) #include #endif -#if defined(HAVE_NANOSLEEP) && defined(HAVE_TIME_H) -#include -#endif #if defined(HAVE_GETSYSTEMTIMEASFILETIME) #define WIN32_LEAN_AND_MEAN #include -- cgit v1.2.3