Issue #8096 has been updated by naruse (Yui NARUSE).


kosaki (Motohiro KOSAKI) wrote:
> (3/19/13 9:31 PM), headius (Charles Nutter) wrote:
>  > 
>  > Issue #8096 has been updated by headius (Charles Nutter).
>  > 
>  > 
>  > naruse (Yui NARUSE) wrote:
>  >> What class is it?
>  >> If Float, it introduces extra error.
>  >> If Rational, I feel Time is better.
>  > 
>  > It is a Fixnum:
>  
>  Fixnum is bad idea because it doesn't have enough bits when using 32bit environment. 
>  Java's System.nanoTime() always return 64bit value.

At the allocation view, there are 3 types:
1. embeded in VALUE itself
2. embeded in struct RVALUE
3. VALUE and extra data

Fixnum and small Float (flonum) is 1, it doesn't need GC.
Small Time, large Float, small Bignum, small Rational, are 2.

On 32bit, there is no way to embeded microsecond to first types.
So using Bignum is acceptable.


Just a note, the API should use CLOCK_MONOTONIC for clock_gettime.
----------------------------------------
Feature #8096: introduce Time.current_timestamp
https://bugs.ruby-lang.org/issues/8096#change-37759

Author: vipulnsward (Vipul Amler)
Status: Feedback
Priority: Low
Assignee: 
Category: 
Target version: 


=begin
A lot of scenarios and applications require the use of (({Time.now.to_i})) which is used as current_timestamp in systems.

The introduction of (({Time.current_timestamp})) {or something with similar with different name} would provide implicit integer timestamp instead of going from 
(({Time.now})) -> time_object -> to_i -> integer timestamp value

So instead of

 Time.now.to_i # Outputs => 1363274618

one could use

 Time.current_timestamp # Outputs => 1363274618

=end



-- 
http://bugs.ruby-lang.org/