patch 9.1.1721: Defining a global gettimeofday() function
Commit:
https://github.com/vim/vim/commit/bf91eb762069e6f23b2e0425c497cfb05057c08c
Author: Hirohito Higashi <
h.eas...@gmail.com>
Date: Sun Aug 31 19:43:23 2025 +0200
patch 9.1.1721: Defining a global gettimeofday() function
Problem: Defining a global gettimeofday() function causes conflicts if
gettimeofday() is already defined.
Solution: Revert globalized gettimeofday() function (Hirohito Higashi).
fixes: #18162
fixes: #18161
fixes: #18170
closes: #18173
Signed-off-by: Hirohito Higashi <
h.eas...@gmail.com>
Signed-off-by: Christian Brabandt <
c...@256bit.org>
diff --git a/src/proto/
time.pro b/src/proto/
time.pro
index 9d6d9e962..7e44bca1b 100644
--- a/src/proto/
time.pro
+++ b/src/proto/
time.pro
@@ -20,9 +20,6 @@ void f_timer_pause(typval_T *argvars, typval_T *rettv);
void f_timer_start(typval_T *argvars, typval_T *rettv);
void f_timer_stop(typval_T *argvars, typval_T *rettv);
void f_timer_stopall(typval_T *argvars, typval_T *rettv);
-#if (defined(MSWIN) || defined(__MINGW32__)) && !defined(FEAT_RUBY)
-int gettimeofday(struct timeval *tv, char *dummy);
-#endif
void time_push(void *tv_rel, void *tv_start);
void time_pop(void *tp);
void time_msg(char *mesg, void *tv_start);
diff --git a/src/time.c b/src/time.c
index 830a94cd6..2fb0c3931 100644
--- a/src/time.c
+++ b/src/time.c
@@ -127,21 +127,6 @@ get_ctime(time_t thetime, int add_newline)
return buf;
}
-// Ruby has its own version of gettimeofday
-#if (defined(MSWIN) || defined(__MINGW32__)) && !defined(FEAT_RUBY)
-/*
- * Windows doesn't have gettimeofday(), although it does have struct timeval.
- */
- int
-gettimeofday(struct timeval *tv, char *dummy UNUSED)
-{
- long t = clock();
- tv->tv_sec = t / CLOCKS_PER_SEC;
- tv->tv_usec = (t - tv->tv_sec * CLOCKS_PER_SEC) * 1000000 / CLOCKS_PER_SEC;
- return 0;
-}
-#endif
-
#if defined(FEAT_EVAL) || defined(PROTO)
#if defined(MACOS_X)
@@ -962,6 +947,20 @@ f_timer_stopall(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
# if defined(STARTUPTIME) || defined(PROTO)
static struct timeval prev_timeval;
+# ifdef MSWIN
+/*
+ * Windows doesn't have gettimeofday(), although it does have struct timeval.
+ */
+ static int
+gettimeofday(struct timeval *tv, char *dummy UNUSED)
+{
+ long t = clock();
+ tv->tv_sec = t / CLOCKS_PER_SEC;
+ tv->tv_usec = (t - tv->tv_sec * CLOCKS_PER_SEC) * 1000000 / CLOCKS_PER_SEC;
+ return 0;
+}
+# endif
+
/*
* Save the previous time before doing something that could nest.
* set "*tv_rel" to the time elapsed so far.
diff --git a/src/version.c b/src/version.c
index a32324fd9..2ce3628bf 100644
--- a/src/version.c
+++ b/src/version.c
@@ -724,6 +724,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1721,
/**/
1720,
/**/