summaryrefslogtreecommitdiff
path: root/time.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-22 14:23:33 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-22 14:23:33 +0000
commit12d2c8ba41edb5a02a7471e39d67ece2894492d8 (patch)
tree5b2e87ac380efcb2141c4fab97e86c25c7214799 /time.c
parent624d07b0e4257a5261558a154eddd464d85e6174 (diff)
stripped trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'time.c')
-rw-r--r--time.c158
1 files changed, 79 insertions, 79 deletions
diff --git a/time.c b/time.c
index f6a754a332..5542c79c9b 100644
--- a/time.c
+++ b/time.c
@@ -74,18 +74,18 @@ time_modify(VALUE time)
/*
* call-seq:
* Time.new -> time
- *
+ *
* Returns a <code>Time</code> object initialized to the current system
* time. <b>Note:</b> The object created will be created using the
* resolution available on your system clock, and so may include
* fractional seconds.
- *
+ *
* a = Time.new #=> 2007-11-19 07:50:02 -0600
* b = Time.new #=> 2007-11-19 07:50:02 -0600
* a == b #=> false
* "%.6f" % a.to_f #=> "1195480202.282373"
* "%.6f" % b.to_f #=> "1195480202.283415"
- *
+ *
*/
static VALUE
@@ -104,7 +104,7 @@ time_init(VALUE time)
}
#else
{
- struct timeval tv;
+ struct timeval tv;
if (gettimeofday(&tv, 0) < 0) {
rb_sys_fail("gettimeofday");
}
@@ -297,14 +297,14 @@ rb_time_timespec(VALUE time)
* Time.at(time) => time
* Time.at(seconds_with_frac) => time
* Time.at(seconds, microseconds_with_frac) => time
- *
+ *
* Creates a new time object with the value given by <i>time</i>,
* the given number of <i>seconds_with_frac</i>, or
* <i>seconds</i> and <i>microseconds_with_frac</i> from the Epoch.
* <i>seconds_with_frac</i> and <i>microseconds_with_frac</i>
* can be Integer, Float, Rational, or other Numeric.
* non-portable feature allows the offset to be negative on some systems.
- *
+ *
* Time.at(0) #=> 1969-12-31 18:00:00 -0600
* Time.at(Time.at(0)) #=> 1969-12-31 18:00:00 -0600
* Time.at(946702800) #=> 1999-12-31 23:00:00 -0600
@@ -667,7 +667,7 @@ search_time_t(struct tm *tptr, int utc_p)
To avoid overflow in this assignment, `d' is restricted to less than
sqrt(2**31). By this restriction and other reasons, the guess is
- not accurate and some error is expected. `range' approximates
+ not accurate and some error is expected. `range' approximates
the maximum error.
When these parameters are not suitable, i.e. guess is not within
@@ -726,7 +726,7 @@ search_time_t(struct tm *tptr, int utc_p)
}
if (guess <= guess_lo || guess_hi <= guess) {
- /* Precious guess is invalid. try binary search. */
+ /* Precious guess is invalid. try binary search. */
guess = guess_lo / 2 + guess_hi / 2;
if (guess <= guess_lo)
guess = guess_lo + 1;
@@ -738,7 +738,7 @@ search_time_t(struct tm *tptr, int utc_p)
tm = GUESS(&guess);
if (!tm) goto error;
have_guess = 0;
-
+
d = tmcmp(tptr, tm);
if (d < 0) {
guess_hi = guess;
@@ -922,7 +922,7 @@ time_utc_or_local(int argc, VALUE *argv, int utc_p, VALUE klass)
* Time.gm(year, month, day, hour, min, sec_with_frac) => time
* Time.gm(year, month, day, hour, min, sec, usec_with_frac) => time
* Time.gm(sec, min, hour, day, month, year, wday, yday, isdst, tz) => time
- *
+ *
* Creates a time based on given values, interpreted as UTC (GMT). The
* year must be specified. Other values default to the minimum value
* for that field (and may be <code>nil</code> or omitted). Months may
@@ -960,10 +960,10 @@ time_s_mkutc(int argc, VALUE *argv, VALUE klass)
* Time.mktime(year, month, day, hour, min, sec_with_frac) => time
* Time.mktime(year, month, day, hour, min, sec, usec_with_frac) => time
* Time.mktime(sec, min, hour, day, month, year, wday, yday, isdst, tz) => time
- *
+ *
* Same as <code>Time::gm</code>, but interprets the values in the
* local time zone.
- *
+ *
* Time.local(2000,"jan",1,20,15,1) #=> 2000-01-01 20:15:01 -0600
*/
@@ -977,10 +977,10 @@ time_s_mktime(int argc, VALUE *argv, VALUE klass)
* call-seq:
* time.to_i => int
* time.tv_sec => int
- *
+ *
* Returns the value of <i>time</i> as an integer number of seconds
* since the Epoch.
- *
+ *
* t = Time.now
* "%10.5f" % t.to_f #=> "1049896564.17839"
* t.to_i #=> 1049896564
@@ -998,10 +998,10 @@ time_to_i(VALUE time)
/*
* call-seq:
* time.to_f => float
- *
+ *
* Returns the value of <i>time</i> as a floating point number of
* seconds since the Epoch.
- *
+ *
* t = Time.now
* "%10.5f" % t.to_f #=> "1049896564.13654"
* t.to_i #=> 1049896564
@@ -1023,9 +1023,9 @@ time_to_f(VALUE time)
* call-seq:
* time.usec => int
* time.tv_usec => int
- *
+ *
* Returns just the number of microseconds for <i>time</i>.
- *
+ *
* t = Time.now #=> 2007-11-19 08:03:26 -0600
* "%10.6f" % t.to_f #=> "1195481006.775195"
* t.usec #=> 775195
@@ -1044,9 +1044,9 @@ time_usec(VALUE time)
* call-seq:
* time.nsec => int
* time.tv_nsec => int
- *
+ *
* Returns just the number of nanoseconds for <i>time</i>.
- *
+ *
* t = Time.now #=> 2007-11-17 15:18:03 +0900
* "%10.9f" % t.to_f #=> "1195280283.536151409"
* t.nsec #=> 536151406
@@ -1068,15 +1068,15 @@ time_nsec(VALUE time)
/*
* call-seq:
- * time <=> other_time => -1, 0, +1
- *
+ * time <=> other_time => -1, 0, +1
+ *
* Comparison---Compares <i>time</i> with <i>other_time</i>.
- *
+ *
* t = Time.now #=> 2007-11-19 08:12:12 -0600
* t2 = t + 2592000 #=> 2007-12-19 08:12:12 -0600
* t <=> t2 #=> -1
* t2 <=> t #=> 1
- *
+ *
* t = Time.now #=> 2007-11-19 08:13:38 -0600
* t2 = t + 0.1 #=> 2007-11-19 08:13:38 -0600
* t.nsec #=> 98222999
@@ -1144,10 +1144,10 @@ time_eql(VALUE time1, VALUE time2)
* call-seq:
* time.utc? => true or false
* time.gmt? => true or false
- *
+ *
* Returns <code>true</code> if <i>time</i> represents a time in UTC
* (GMT).
- *
+ *
* t = Time.now #=> 2007-11-19 08:15:23 -0600
* t.utc? #=> false
* t = Time.gm(2000,"jan",1,20,15,1) #=> 2000-01-01 20:15:01 UTC
@@ -1216,10 +1216,10 @@ time_dup(VALUE time)
/*
* call-seq:
* time.localtime => time
- *
+ *
* Converts <i>time</i> to local time (using the local time zone in
* effect for this process) modifying the receiver.
- *
+ *
* t = Time.gm(2000, "jan", 1, 20, 15, 1) #=> 2000-01-01 20:15:01 UTC
* t.gmt? #=> true
* t.localtime #=> 2000-01-01 14:15:01 -0600
@@ -1256,9 +1256,9 @@ time_localtime(VALUE time)
* call-seq:
* time.gmtime => time
* time.utc => time
- *
+ *
* Converts <i>time</i> to UTC (GMT), modifying the receiver.
- *
+ *
* t = Time.now #=> 2007-11-19 08:18:31 -0600
* t.gmt? #=> false
* t.gmtime #=> 2007-11-19 14:18:31 UTC
@@ -1299,10 +1299,10 @@ time_gmtime(VALUE time)
/*
* call-seq:
* time.getlocal => new_time
- *
+ *
* Returns a new <code>new_time</code> object representing <i>time</i> in
* local time (using the local time zone in effect for this process).
- *
+ *
* t = Time.gm(2000,1,1,20,15,1) #=> 2000-01-01 20:15:01 UTC
* t.gmt? #=> true
* l = t.getlocal #=> 2000-01-01 14:15:01 -0600
@@ -1320,10 +1320,10 @@ time_getlocaltime(VALUE time)
* call-seq:
* time.getgm => new_time
* time.getutc => new_time
- *
+ *
* Returns a new <code>new_time</code> object representing <i>time</i> in
* UTC.
- *
+ *
* t = Time.local(2000,1,1,20,15,1) #=> 2000-01-01 20:15:01 -0600
* t.gmt? #=> false
* y = t.getgm #=> 2000-01-02 02:15:01 UTC
@@ -1348,9 +1348,9 @@ time_get_tm(VALUE time, int gmt)
* call-seq:
* time.asctime => string
* time.ctime => string
- *
+ *
* Returns a canonical string representation of <i>time</i>.
- *
+ *
* Time.now.asctime #=> "Wed Apr 9 08:56:03 2003"
*/
@@ -1383,14 +1383,14 @@ rb_strftime(char *s, size_t maxsize, const char *format,
* call-seq:
* time.inspect => string
* time.to_s => string
- *
+ *
* Returns a string representing <i>time</i>. Equivalent to calling
* <code>Time#strftime</code> with a format string of
* ``<code>%Y-%m-%d</code> <code>%H:%M:%S</code> <code>%z</code>''
* for a local time and
* ``<code>%Y-%m-%d</code> <code>%H:%M:%S</code> <code>UTC</code>''
* for a UTC time.
- *
+ *
* Time.now.to_s #=> "2007-10-05 16:09:51 +0900"
* Time.now.utc.to_s #=> "2007-10-05 07:09:51 UTC"
*/
@@ -1461,10 +1461,10 @@ time_add(struct time_object *tobj, VALUE offset, int sign)
/*
* call-seq:
* time + numeric => time
- *
+ *
* Addition---Adds some number of seconds (possibly fractional) to
* <i>time</i> and returns that value as a new time.
- *
+ *
* t = Time.now #=> 2007-11-19 08:22:21 -0600
* t + (60 * 60 * 24) #=> 2007-11-20 08:22:21 -0600
*/
@@ -1485,11 +1485,11 @@ time_plus(VALUE time1, VALUE time2)
* call-seq:
* time - other_time => float
* time - numeric => time
- *
+ *
* Difference---Returns a new time that represents the difference
* between two times, or subtracts the given number of seconds in
* <i>numeric</i> from <i>time</i>.
- *
+ *
* t = Time.now #=> 2007-11-19 08:23:10 -0600
* t2 = t + 2592000 #=> 2007-12-19 08:23:10 -0600
* t2 - t #=> 2592000.0
@@ -1551,12 +1551,12 @@ rb_time_succ(VALUE time)
/*
* call-seq:
* time.sec => fixnum
- *
+ *
* Returns the second of the minute (0..60)<em>[Yes, seconds really can
* range from zero to 60. This allows the system to inject leap seconds
* every now and then to correct for the fact that years are not really
* a convenient number of hours long.]</em> for <i>time</i>.
- *
+ *
* t = Time.now #=> 2007-11-19 08:25:02 -0600
* t.sec #=> 2
*/
@@ -1576,9 +1576,9 @@ time_sec(VALUE time)
/*
* call-seq:
* time.min => fixnum
- *
+ *
* Returns the minute of the hour (0..59) for <i>time</i>.
- *
+ *
* t = Time.now #=> 2007-11-19 08:25:51 -0600
* t.min #=> 25
*/
@@ -1598,9 +1598,9 @@ time_min(VALUE time)
/*
* call-seq:
* time.hour => fixnum
- *
+ *
* Returns the hour of the day (0..23) for <i>time</i>.
- *
+ *
* t = Time.now #=> 2007-11-19 08:26:20 -0600
* t.hour #=> 8
*/
@@ -1621,9 +1621,9 @@ time_hour(VALUE time)
* call-seq:
* time.day => fixnum
* time.mday => fixnum
- *
+ *
* Returns the day of the month (1..n) for <i>time</i>.
- *
+ *
* t = Time.now #=> 2007-11-19 08:27:03 -0600
* t.day #=> 19
* t.mday #=> 19
@@ -1645,9 +1645,9 @@ time_mday(VALUE time)
* call-seq:
* time.mon => fixnum
* time.month => fixnum
- *
+ *
* Returns the month of the year (1..12) for <i>time</i>.
- *
+ *
* t = Time.now #=> 2007-11-19 08:27:30 -0600
* t.mon #=> 11
* t.month #=> 11
@@ -1668,9 +1668,9 @@ time_mon(VALUE time)
/*
* call-seq:
* time.year => fixnum
- *
+ *
* Returns the year for <i>time</i> (including the century).
- *
+ *
* t = Time.now #=> 2007-11-19 08:27:51 -0600
* t.year #=> 2007
*/
@@ -1690,10 +1690,10 @@ time_year(VALUE time)
/*
* call-seq:
* time.wday => fixnum
- *
+ *
* Returns an integer representing the day of the week, 0..6, with
* Sunday == 0.
- *
+ *
* t = Time.now #=> 2007-11-20 02:35:35 -0600
* t.wday #=> 2
* t.sunday? #=> false
@@ -1729,9 +1729,9 @@ time_wday(VALUE time)
/*
* call-seq:
* time.sunday? => true or false
- *
+ *
* Returns <code>true</code> if <i>time</i> represents Sunday.
- *
+ *
* t = Time.local(1990, 4, 1) #=> 1990-04-01 00:00:00 -0600
* t.sunday? #=> true
*/
@@ -1745,7 +1745,7 @@ time_sunday(VALUE time)
/*
* call-seq:
* time.monday? => true or false
- *
+ *
* Returns <code>true</code> if <i>time</i> represents Monday.
*
* t = Time.local(2003, 8, 4) #=> 2003-08-04 00:00:00 -0500
@@ -1761,7 +1761,7 @@ time_monday(VALUE time)
/*
* call-seq:
* time.tuesday? => true or false
- *
+ *
* Returns <code>true</code> if <i>time</i> represents Tuesday.
*
* t = Time.local(1991, 2, 19) #=> 1991-02-19 00:00:00 -0600
@@ -1777,7 +1777,7 @@ time_tuesday(VALUE time)
/*
* call-seq:
* time.wednesday? => true or false
- *
+ *
* Returns <code>true</code> if <i>time</i> represents Wednesday.
*
* t = Time.local(1993, 2, 24) #=> 1993-02-24 00:00:00 -0600
@@ -1793,7 +1793,7 @@ time_wednesday(VALUE time)
/*
* call-seq:
* time.thursday? => true or false
- *
+ *
* Returns <code>true</code> if <i>time</i> represents Thursday.
*
* t = Time.local(1995, 12, 21) #=> 1995-12-21 00:00:00 -0600
@@ -1809,7 +1809,7 @@ time_thursday(VALUE time)
/*
* call-seq:
* time.friday? => true or false
- *
+ *
* Returns <code>true</code> if <i>time</i> represents Friday.
*
* t = Time.local(1987, 12, 18) #=> 1987-12-18 00:00:00 -0600
@@ -1825,7 +1825,7 @@ time_friday(VALUE time)
/*
* call-seq:
* time.saturday? => true or false
- *
+ *
* Returns <code>true</code> if <i>time</i> represents Saturday.
*
* t = Time.local(2006, 6, 10) #=> 2006-06-10 00:00:00 -0500
@@ -1841,9 +1841,9 @@ time_saturday(VALUE time)
/*
* call-seq:
* time.yday => fixnum
- *
+ *
* Returns an integer representing the day of the year, 1..366.
- *
+ *
* t = Time.now #=> 2007-11-19 08:32:31 -0600
* t.yday #=> 323
*/
@@ -1864,10 +1864,10 @@ time_yday(VALUE time)
* call-seq:
* time.isdst => true or false
* time.dst? => true or false
- *
+ *
* Returns <code>true</code> if <i>time</i> occurs during Daylight
* Saving Time in its time zone.
- *
+ *
* # CST6CDT:
* Time.local(2000, 1, 1).zone #=> "CST"
* Time.local(2000, 1, 1).isdst #=> false
@@ -1900,10 +1900,10 @@ time_isdst(VALUE time)
/*
* call-seq:
* time.zone => string
- *
+ *
* Returns the name of the time zone used for <i>time</i>. As of Ruby
* 1.8, returns ``UTC'' rather than ``GMT'' for UTC times.
- *
+ *
* t = Time.gm(2000, "jan", 1, 20, 15, 1)
* t.zone #=> "UTC"
* t = Time.local(2000, "jan", 1, 20, 15, 1)
@@ -1918,7 +1918,7 @@ time_zone(VALUE time)
char buf[64];
int len;
#endif
-
+
GetTimeval(time, tobj);
if (tobj->tm_got == 0) {
time_get_tm(time, tobj->gmt);
@@ -1943,10 +1943,10 @@ time_zone(VALUE time)
* time.gmt_offset => fixnum
* time.gmtoff => fixnum
* time.utc_offset => fixnum
- *
+ *
* Returns the offset in seconds between the timezone of <i>time</i>
* and UTC.
- *
+ *
* t = Time.gm(2000,1,1,20,15,1) #=> 2000-01-01 20:15:01 UTC
* t.gmt_offset #=> 0
* l = t.getlocal #=> 2000-01-01 14:15:01 -0600
@@ -1998,14 +1998,14 @@ time_utc_offset(VALUE time)
/*
* call-seq:
* time.to_a => array
- *
+ *
* Returns a ten-element <i>array</i> of values for <i>time</i>:
* {<code>[ sec, min, hour, day, month, year, wday, yday, isdst, zone
* ]</code>}. See the individual methods for an explanation of the
* valid ranges of each value. The ten elements can be passed directly
* to <code>Time::utc</code> or <code>Time::local</code> to create a
* new <code>Time</code>.
- *
+ *
* t = Time.now #=> 2007-11-19 08:36:01 -0600
* now = t.to_a #=> [1, 36, 8, 19, 11, 2007, 1, 323, false, "CST"]
*/
@@ -2067,7 +2067,7 @@ rb_strftime_alloc(char **buf, const char *format,
/*
* call-seq:
* time.strftime( string ) => string
- *
+ *
* Formats <i>time</i> according to the directives in the given format
* string. Any text not listed as a directive will be passed through
* to the output string.
@@ -2107,7 +2107,7 @@ rb_strftime_alloc(char **buf, const char *format,
* %Y - Year with century
* %Z - Time zone name
* %% - Literal ``%'' character
- *
+ *
* t = Time.now #=> 2007-11-19 08:37:48 -0600
* t.strftime("Printed on %m/%d/%Y") #=> "Printed on 11/19/2007"
* t.strftime("at %I:%M%p") #=> "at 08:37AM"
@@ -2247,7 +2247,7 @@ time_dump(int argc, VALUE *argv, VALUE time)
VALUE str;
rb_scan_args(argc, argv, "01", 0);
- str = time_mdump(time);
+ str = time_mdump(time);
return str;
}
@@ -2370,7 +2370,7 @@ time_load(VALUE klass, VALUE str)
* as equivalent. GMT is the older way of referring to these
* baseline times but persists in the names of calls on POSIX
* systems.
- *
+ *
* All times are stored with some number of nanoseconds. Be aware of
* this fact when comparing times with each other---times that are
* apparently equal when displayed may be different when compared.