Class: R4r::SystemClockExt

Inherits:
Object
  • Object
show all
Defined in:
ext/r4r/system_clock_ext/system_clock_ext.c

Instance Method Summary collapse

Instance Method Details

#callObject

Returns current system time in milliseconds.



7
8
9
10
11
12
13
14
15
16
17
18
# File 'ext/r4r/system_clock_ext/system_clock_ext.c', line 7

static VALUE
system_clock_call(VALUE self) {
  struct timeval tv;
  long long millis;

  gettimeofday(&tv, NULL);

  millis = ((long long)tv.tv_sec) * 1000;
  millis = millis + (tv.tv_usec / 1000);

  return LONG2NUM(millis);
}