Method: Time#tv_nsec
- Defined in:
- time.c
#nsec ⇒ Integer
Returns the number of nanoseconds in the subseconds part of self in the range (0..999_999_999); lower-order digits are truncated, not rounded:
t = Time.now # => 2022-07-11 15:04:53.3219637 -0500
t.nsec # => 321963700
Related: Time#subsec (returns exact subseconds).
3855 3856 3857 3858 3859 3860 3861 3862 |
# File 'time.c', line 3855 static VALUE time_nsec(VALUE time) { struct time_object *tobj; GetTimeval(time, tobj); return rb_to_int(w2v(wmulquoll(wmod(tobj->timew, WINT2WV(TIME_SCALE)), 1000000000, TIME_SCALE))); } |