Time.utc problem with arrays? 
Author Message
 Time.utc problem with arrays?

The entry for Time#to_a at
http://www.*-*-*.com/ #to_a states:

    The ten elements can be passed directly to Time::utc or Time::local to
create a new Time.

But when I it, this is what happens:

% ruby -e "Time.utc(Time.now.to_a)"
-e:1:in `utc': failed to convert Array into Integer (TypeError)
        from -e:1

Is this the correct usage, or is it a problem with Time's utc method?



Tue, 27 Apr 2004 23:33:00 GMT  
 Time.utc problem with arrays?

D> The entry for Time#to_a at
D> http://www.rubycentral.com/book/ref_c_time.html#to_a states:

D>     The ten elements can be passed directly to Time::utc or Time::local to
D> create a new Time.

D> But when I it, this is what happens:

D> % ruby -e "Time.utc(Time.now.to_a)"

 Write it

   ruby -e "Time.utc(*Time.now.to_a)"

 Time.utc(Time.now.to_a)  give only one element (an array) to Time::utc
 Time.utc(*Time.now.to_a) give 10 elements to Time::utc

Guy Decoux



Tue, 27 Apr 2004 23:38:21 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. UTC time conversion to internal time

2. Converting a time to UTC and displaying it

3. UTC equivalent of time.mktime() ?

4. UTC (GMT) time in VisualAge

5. UTC (GMT) time in VisualAge

6. Bug in time.c (was Time.times problems)

7. Problem with with Array of U8 to Array of Array of Boolean

8. Difficult problem to solve: Tcl 7.3 to Tcl 8.0p2 Array of Array Problem

9. Question: how to convert a local Date & Time to UTC Date & Time

10. GMT vs UTC

11. Run-time & Design-time window size problem

12. Help!: problem with fast timing for real-time application on PC

 

 
Powered by phpBB® Forum Software