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

218 Коммитов

Автор SHA1 Сообщение Дата
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
usa 8da932fe46 * dir.c (glob_helper): C99(gcc)-ism.
* time.c (find_time_t): GUESS macro needs the variable named ``result''
	  always.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23255 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-22 01:40:09 +00:00
nobu d5704eb61a * time.c (localtime_with_gmtoff): fixed cross function jump.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23254 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-22 00:27:33 +00:00
akr 6df2f3d59c add comment.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23250 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-21 17:41:24 +00:00
akr f67380be58 update rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23249 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-21 17:16:11 +00:00
akr 16dc9e04cb * time.c (time_arg): use the year argument as-is. [ruby-dev:38194]
* lib/time.rb (Time.parse): interpret small year 0..99 as 1950..2049.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23247 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-21 16:43:15 +00:00
nobu ac3dcc30da * time.c (find_time_t): constified.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23245 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-21 15:32:19 +00:00
akr 1dd6a6dfa4 * time.c (leap_year_v_p): removed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-21 15:11:44 +00:00
akr 3bc16f62c1 * time.c: remove time_t restriction from Time class.
* timev.h: new file to define struct vtm.

* strftime.c: format struct vtm instead of struct tm.

* ext/syck/rubyext.c (mktime_do): don't use time_t;

[ruby-dev:38191]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23242 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-21 14:56:59 +00:00
akr 29983664fc * time.c (time_cmp): negate the result of reverse comparison.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23075 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-26 16:35:18 +00:00
akr 4a0bb2dc48 * time.c (time_timespec): use NUM2TIMET.
(time_s_at): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23060 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-23 13:02:12 +00:00
akr d1bc6cc720 * time.c (time_mload): don't clear tm_mday.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22892 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-11 12:23:41 +00:00
nobu 8231655dea * time.c (time_to_i, time_hash): time_t may be bigger than long
and int.

* time.c (time_timeval, rb_time_timeval, obj2nsec, time_strftime),
  (time_mdump, time_mload): suppress warnings.

* win32/Makefile.sub (config.h): added TIMET2NUM and NUM2TIMET.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22880 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-10 19:47:46 +00:00
nobu 12d2c8ba41 stripped trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-22 14:23:33 +00:00
mame e722ad99d5 * string.c (rb_hash_uint32, rb_hash_uint, rb_hash_start, rb_hash_end),
include/ruby/intern.h: add Murmurhash API.  [ruby-dev:37784]

* complex.c (nucomp_hash), array.c (rb_ary_hash), time.c (time_hash),
  string.c (rb_str_hsah), object.c (rb_obj_hash), range.c
  (range_hash), struct.c (rb_struct_hash), hash.c (rb_any_hash),
  rational.c (nurat_hash): use Murmurhash.  [ruby-dev:37784]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22317 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-14 19:55:34 +00:00
matz b5ae8db530 * time.c (LOCALTIME): should call tzset() before localtime_r().
[ruby-dev:37896]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-04 19:09:58 +00:00
matz 31b6ea65bb * include/ruby/ruby.h (DBL2NUM): renamed from DOUBLE2NUM.
a patch from Tadashi Saito <shiba at mail2.accsnet.ne.jp>
  in [ruby-dev:36102].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19160 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-05 18:24:21 +00:00
shugo 63846d48a9 * strftime.c (rb_strftime): supported %s and %P.
* time.c (time_strftime): ditto.
* test/ruby/test_time.rb (test_strftime): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18909 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-28 17:06:20 +00:00
usa 8039100c0a * time.c (time_asctime): workaround for MSVCRT's bug.
based on a patch from wanabe <s.wanabe AT gmail.com> at
	  [ruby-dev:35831] and a suggestion by KIMURA Koichi
	  <kbk AT kt.rim.or.jp> at [ruby-dev:35832]
	  fixed [ruby-dev:35555]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-26 13:47:17 +00:00
nobu 504ed85dfe * configure.in (gmtime_r): check if reentrant versions are available.
* time.c (IF_HAVE_GMTIME_R, ASCTIME, GMTIME, LOCALTIME): use reentrant
  versions if available.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18767 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-22 01:52:42 +00:00
shugo a0cc5b19b7 * strftime.c (rb_strftime): supported %F and %<precision>N.
reverted config.h to ruby.h for Windows.
* test/ruby/test_time.rb (TestTime::test_strftime): added tests
  for %F and %N.
* time.c: documented %F and %N.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-21 14:57:35 +00:00
shugo 99155ccbf2 * configure.in: removed strftime from AC_REPLACE_FUNCS().
* include/ruby/missing.h: removed prototype for strftime().
* missing/strftime.c: removed.
* time.c (time_to_s): use rb_strftime() instead of strftime(3).
  (time_zone): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-20 16:04:11 +00:00