[Groonga-commit] groonga/groonga at ed57969 [master] Export grn_timeval and grn_timeval_now()

Back to archive index

Kouhei Sutou null+****@clear*****
Mon Jun 13 16:32:29 JST 2016


Kouhei Sutou	2016-06-13 16:32:29 +0900 (Mon, 13 Jun 2016)

  New Revision: ed57969cd97fee2230494fc1f0534e0263694fcf
  https://github.com/groonga/groonga/commit/ed57969cd97fee2230494fc1f0534e0263694fcf

  Message:
    Export grn_timeval and grn_timeval_now()

  Modified files:
    include/groonga/time.h
    lib/grn_time.h

  Modified: include/groonga/time.h (+19 -0)
===================================================================
--- include/groonga/time.h    2016-06-12 12:28:22 +0900 (dd242ba)
+++ include/groonga/time.h    2016-06-13 16:32:29 +0900 (3c88492)
@@ -24,6 +24,23 @@
 extern "C" {
 #endif
 
+typedef struct {
+  int64_t tv_sec;
+  int32_t tv_nsec;
+} grn_timeval;
+
+#define GRN_TIMEVAL_TO_MSEC(timeval)                    \
+  (((timeval)->tv_sec * GRN_TIME_MSEC_PER_SEC) +        \
+   ((timeval)->tv_nsec / GRN_TIME_NSEC_PER_MSEC))
+
+#define GRN_TIME_NSEC_PER_SEC 1000000000
+#define GRN_TIME_NSEC_PER_SEC_F 1000000000.0
+#define GRN_TIME_NSEC_PER_MSEC 1000000
+#define GRN_TIME_NSEC_PER_USEC (GRN_TIME_NSEC_PER_SEC / GRN_TIME_USEC_PER_SEC)
+#define GRN_TIME_MSEC_PER_SEC 1000
+#define GRN_TIME_NSEC_TO_USEC(nsec) ((nsec) / GRN_TIME_NSEC_PER_USEC)
+#define GRN_TIME_USEC_TO_NSEC(usec) ((usec) * GRN_TIME_NSEC_PER_USEC)
+
 #define GRN_TIME_USEC_PER_SEC 1000000
 #define GRN_TIME_PACK(sec, usec) ((int64_t)(sec) * GRN_TIME_USEC_PER_SEC + (usec))
 #define GRN_TIME_UNPACK(time_value, sec, usec) do {\
@@ -31,6 +48,8 @@ extern "C" {
   usec = (time_value) % GRN_TIME_USEC_PER_SEC;\
 } while (0)
 
+GRN_API grn_rc grn_timeval_now(grn_ctx *ctx, grn_timeval *tv);
+
 GRN_API void grn_time_now(grn_ctx *ctx, grn_obj *obj);
 
 #define GRN_TIME_NOW(ctx,obj) (grn_time_now((ctx), (obj)))

  Modified: lib/grn_time.h (+1 -17)
===================================================================
--- lib/grn_time.h    2016-06-12 12:28:22 +0900 (363e3c8)
+++ lib/grn_time.h    2016-06-13 16:32:29 +0900 (1db9948)
@@ -24,29 +24,13 @@
 extern "C" {
 #endif
 
-typedef struct {
-  int64_t tv_sec;
-  int32_t tv_nsec;
-} grn_timeval;
-
 #ifndef GRN_TIMEVAL_STR_SIZE
 #define GRN_TIMEVAL_STR_SIZE 0x100
 #endif /* GRN_TIMEVAL_STR_SIZE */
 #ifndef GRN_TIMEVAL_STR_FORMAT
 #define GRN_TIMEVAL_STR_FORMAT "%04d-%02d-%02d %02d:%02d:%02d.%06d"
 #endif /* GRN_TIMEVAL_STR_FORMAT */
-#define GRN_TIMEVAL_TO_MSEC(timeval)                    \
-  (((timeval)->tv_sec * GRN_TIME_MSEC_PER_SEC) +        \
-   ((timeval)->tv_nsec / GRN_TIME_NSEC_PER_MSEC))
-#define GRN_TIME_NSEC_PER_SEC 1000000000
-#define GRN_TIME_NSEC_PER_SEC_F 1000000000.0
-#define GRN_TIME_NSEC_PER_MSEC 1000000
-#define GRN_TIME_NSEC_PER_USEC (GRN_TIME_NSEC_PER_SEC / GRN_TIME_USEC_PER_SEC)
-#define GRN_TIME_MSEC_PER_SEC 1000
-#define GRN_TIME_NSEC_TO_USEC(nsec) ((nsec) / GRN_TIME_NSEC_PER_USEC)
-#define GRN_TIME_USEC_TO_NSEC(usec) ((usec) * GRN_TIME_NSEC_PER_USEC)
-
-GRN_API grn_rc grn_timeval_now(grn_ctx *ctx, grn_timeval *tv);
+
 GRN_API grn_rc grn_timeval2str(grn_ctx *ctx, grn_timeval *tv, char *buf, size_t buf_size);
 struct tm *grn_timeval2tm(grn_ctx *ctx, grn_timeval *tv, struct tm *tm_buffer);
 grn_rc grn_str2timeval(const char *str, uint32_t str_len, grn_timeval *tv);
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index