]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.1721: Defining a global gettimeofday() function v9.1.1721
authorHirohito Higashi <h.east.727@gmail.com>
Sun, 31 Aug 2025 17:43:23 +0000 (19:43 +0200)
committerChristian Brabandt <cb@256bit.org>
Sun, 31 Aug 2025 17:43:23 +0000 (19:43 +0200)
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.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/proto/time.pro
src/time.c
src/version.c

index 9d6d9e962a83af9524bf32fcbea15ae6941e849e..7e44bca1b7c8fcbbcc6382d2183bf24d57fa10c3 100644 (file)
@@ -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);
index 830a94cd61e7c8b87e6908e33578c2967cd173ce..2fb0c39317b83410dd9d4f6f792c2edf1e1d51c4 100644 (file)
@@ -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.
index a32324fd953a479ebaa19782497713c36835b767..2ce3628bf1c6eb8801f8b4ff0225dc9cf6d48608 100644 (file)
@@ -724,6 +724,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1721,
 /**/
     1720,
 /**/