Commits

antirez  committed d59abab

ustime() added as it is used by scripting.c

  • Participants
  • Parent commits be6e759
  • Tags 2.2.107-scripting

Comments (0)

Files changed (2)

 int isStringRepresentableAsLongLong(sds s, long long *longval);
 int isObjectRepresentableAsLongLong(robj *o, long long *llongval);
 int string2ll(char *s, size_t slen, long long *value);
+long long ustime(void);
 
 /* Configuration */
 void loadServerConfig(char *filename);
 #include "redis.h"
 #include <ctype.h>
 #include <limits.h>
+#include <sys/time.h>
 
 /* Glob-style pattern matching. */
 int stringmatchlen(const char *pattern, int patternLen,
     }
     return 1;
 } 
+
+/* Return the UNIX time in microseconds */
+long long ustime(void) {
+    struct timeval tv;
+    long long ust;
+
+    gettimeofday(&tv, NULL);
+    ust = ((long long)tv.tv_sec)*1000000;
+    ust += tv.tv_usec;
+    return ust;
+}