Граф коммитов

239 Коммитов

Автор SHA1 Сообщение Дата
akr 7c269e72ef * time.c (time_round): new method Time#round. [ruby-dev:40595]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-11 13:39:12 +00:00
akr 795b03c71c * time.c (time_add): propagate fixed time offset.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26670 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-15 13:21:10 +00:00
nobu b3085ba508 * time.c (time_mdump, time_mload): dump/load utc_offset.
[ruby-dev:40063]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26560 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-03 15:37:45 +00:00
nobu 572c266e05 * time.c (quo, time_mdump): use RRATIONAL().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26559 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-03 15:29:15 +00:00
akr 85518db978 add comment.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26557 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-02-03 14:51:39 +00:00
akr 1d674dc547 * time.c (time_mload): add submicro into vtm.subsecx. [ruby-dev:40133]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26377 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-22 12:08:02 +00:00
akr 4bf4ddb693 * time.c (time_to_r): convert to rational if internal representation
is not rational.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-13 23:51:16 +00:00
akr 49ab7b4238 update rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26321 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-13 19:49:39 +00:00
akr d5a96ece85 * time.c (time_mdump): use nano_num and nano_den instead of subnano to
avoid Rational class in marshaled data which prevent unmarshal by
  Ruby 1.8.
  (time_mload): use nano_num and nano_den.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26320 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-01-13 19:04:17 +00:00
matz 2c2cf71b04 * time.c (num_exact): should not accept strings as operands, even
though they respond to #to_r.  ideally, strict rational
  conversion should be done by a method like #to_rational, not #to_r.
  [ruby-core:23729]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-04 07:37:10 +00:00
nobu 4d786d21e3 * removed spaces just before tabs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-26 05:25:08 +00:00
akr b9e0294eda fix typos.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-03 17:46:28 +00:00
marcandre 705c567194 * string.c: rdoc for <=>, casecmp
* bignum.c: rdoc for <=>

* file.c: ditto

* time.c: ditto

* compar.c: rdoc

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25522 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-28 04:50:09 +00:00
matz 9b192302ec * time.c (rb_time_succ): make Time#succ obsolete since time is not
a discrete value.

* range.c (discrete_object_p): treat time objects specially to
  determine discrete values, since time objects have #succ yet are
  discrete (for now at least).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25170 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-30 08:32:43 +00:00
nobu bb09904691 * time.c: fixed type.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25051 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-23 04:16:41 +00:00
akr 87105a7da4 * time.c (time_mdump): error message refined.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24966 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-16 15:36:30 +00:00
nobu fe963a4510 * time.c (rb_time_timeval, rb_time_timespec): typed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-09 04:06:37 +00:00
nobu 5c0a8e947a * time.c (time_data_type): typed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24809 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-09 03:43:48 +00:00
akr 44320bc32c * time.c (find_time_t): use mktime for the first guess.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24718 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-30 14:44:54 +00:00
akr dcf2aad3a5 * time.c (add): shortcut implemented for fixnums.
(sub): ditto.
  (mul): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24710 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-30 04:01:42 +00:00
akr 570d8f55b2 * time.c (eq): apply RTEST.
(ne): ditto.
  (add): avoid method dispatch for bignums.
  (sub): ditto.
  (mul): ditto.
  (mod): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24709 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-30 01:26:56 +00:00
akr 8b32a1de29 * timev.h (TIME_SCALE): defined as 1000000000.
(struct vtm): subsec is replaced by subsecx.
  subsec * TIME_SCALE == subsecx.

* time.c: avoid rational in most cases.
  (struct time_object): timev is replaced by timexv.
  timev * TIME_SCALE == timexv.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24707 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-29 19:06:29 +00:00
akr 4a9bca2496 * time.c (init_leap_second_info): use TIMET_MAX.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24706 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-29 18:18:37 +00:00
nobu 9f66faa374 * time.c (init_leap_second_info): checks the result of gmtime to
suppress warnings.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24247 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-22 15:09:50 +00:00
nobu 796fc30f84 * time.c (time_timespec): rounds subsecond toward zero.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24058 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-12 16:18:18 +00:00
akr b5279bb551 * time.c (find_time_t): fix Time.local(2009,2,31) failure on 64bit
time_t environment.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-05 15:11:27 +00:00
akr 7eb5c0ac74 * time.c (find_time_t): less number of guesses for hh:mm:60.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23949 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-03 13:49:41 +00:00
akr 4e195adda5 * time.c (find_time_t): time guess strategy refined again.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23939 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-02 17:53:21 +00:00
akr e8f835a10e suppress a warning.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23938 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-02 15:42:18 +00:00
akr 26f32868c7 * time.c (find_time_t): time guess strategy refined.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23936 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-02 15:37:06 +00:00
nobu 432768449d * time.c (num_exact): rb_check_to_integer() can deal with both of
Fixnum and Bignum together.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23933 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-01 23:04:46 +00:00
akr 841cf3b948 * time.c (num_exact): use to_r for T_FLOAT.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23929 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-01 20:38:57 +00:00
akr 36b84733f4 * time.c (quo): return an integer if possible.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23928 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-01 20:17:00 +00:00
akr 2cb0c38014 unused variable removed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23927 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-01 18:48:34 +00:00
akr 2f8b6234cd * include/ruby/intern.h (rb_time_num_new): declared.
* time.c (nsec2timev): extracted from time_new_internal.
  (time_new_internal): change argument to VALUE.
  (rb_time_new): follow the argument change.
  (rb_time_nano_new): ditto.
  (rb_time_num_new): new function.

* ext/socket/ancdata.c (ancillary_timestamp): use rb_time_num_new to
  represent struct bintime preciously.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23924 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-01 12:11:53 +00:00
akr c6480cd096 * time.c (time_s_now): new function. Time.now don't take arguments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23840 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-24 11:19:58 +00:00
matz 4f6bfb4a83 * time.c (time_strftime): update RDoc according to info from
Marc-Andre Lafortune in [ruby-core:23575].  [ruby-core:23564]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23599 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-27 18:44:54 +00:00
nobu 762fec4946 * time.c (rb_gmtime, rb_localtime): gmtime and localtime return
NULL on error.  [ruby-core:23551]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23569 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-25 18:41:32 +00:00
mame 3465856922 * time.c (time_minus): always return a Float. [ruby-dev:38446]
* time.c (time_to_r): new method.  [ruby-dev:38461]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23490 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-19 14:00:04 +00:00
akr 6727d4a14a * time.c (time_init_1): unused variable removed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-12 18:21:18 +00:00
akr f64e076260 * time.c: support fixed UTC offset. [ruby-dev:38326]
(leap_year_v_p): new macro.
  (TIME_FIXOFF_P): new macro.
  (TIME_SET_FIXOFF): new macro.
  (time_init_0): renamed from time_init.
  (time_set_utc_offset): new function.
  (vtm_add_offset): new function.
  (utc_offset_arg): new function.
  (time_init_1): new function.
  (time_init): call time_init_0 or time_init_1 according argc.
  (validate_utc_offset): new function.
  (time_localtime_m): new function.
  (time_fixoff): new function.
  (time_getlocaltime): take optional UTC offset argument.
  (time_get_tm): support fixed UTC offset time.
  (Init_Time): make Time#{initialize,localtime,getlocal} varargs.

* strftime.c (rb_strftime): vtm->zone can be NULL now.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23415 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-12 12:07:49 +00:00
akr d75996ec8a * time.c (time_arg): unused variable removed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23290 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-26 10:30:54 +00:00
akr 0dae2c910f * time.c (month_arg): extracted from time_arg.
(validate_vtm): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23276 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-25 07:20:20 +00:00
akr 939383275c * time.c (TIME_COPY_GMT): new macro.
(time_s_at): use TIME_COPY_GMT.
  (time_succ): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23275 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-25 07:04:02 +00:00
akr c7cfaac668 * time.c (time_mload): use TIME_SET_UTC.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23274 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-25 06:54:49 +00:00
akr c8f938d0b5 * time.c (time_get_tm): take time_object instead of gmt.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23273 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-25 06:48:39 +00:00
akr 4c2e943091 * time.c (time_succ): refactored to avoid gmt variable.
(strftimev): use TIME_UTC_P.
  (time_strftime): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23272 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-25 06:40:59 +00:00
akr afbb1ba21b * time.c (TIME_UTC_P): new macro..
(TIME_SET_UTC): ditto.
  (TIME_LOCALTIME_P): ditto.
  (TIME_SET_LOCALTIME): ditto.
  (time_utc_p): use the above macro.
  (time_localtime): ditto.
  (time_localtime): ditto.
  (time_gmtime): ditto.
  (time_to_s): ditto.
  (time_add): ditto.
  (time_sec): ditto.
  (time_min): ditto.
  (time_hour): ditto.
  (time_mday): ditto.
  (time_mon): ditto.
  (time_year): ditto.
  (time_wday): ditto.
  (wday_p): ditto.
  (time_yday): ditto.
  (time_isdst): ditto.
  (time_zone): ditto.
  (time_utc_offset): ditto.
  (time_to_a): ditto.
  (strftimev): ditto.
  (time_strftime): ditto.
  (time_mdump): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23271 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-25 06:25:06 +00:00
nobu a397887e58 * time.c (time_timespec): check out-of-range. [ruby-core:23282]
[Bug #1396]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23260 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-22 11:25:26 +00:00
usa f50bcf9317 * time.c (GMTIME, LOCALTIME): should set result if not have *_r().
* time.c (localtime_with_gmtoff): now always needed tmbuf.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23256 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-22 02:13:44 +00:00