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

63 Коммитов

Автор SHA1 Сообщение Дата
nobu 31bea5d436 unecessary macros and K&R style coding
* strftime.c: remove unnecessary macros to check traditional C.
  https://github.com/ruby/ruby/pull/46 by lateau (Daehyub Kim).
* vsnprintf.c: remove K&R.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36710 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-16 00:46:12 +00:00
nobu 39a3d1793b strftime.c: triple colons modifier
partially borrowed from ext/date.

* strftime.c (rb_strftime_with_timespec): support GNU extension triple
  colons modifier.  [EXPERIMENTAL]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35836 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-29 08:28:13 +00:00
nobu 241902e709 strftime.c: fix locale modifier
partially borrowed from ext/date.

* strftime.c (rb_strftime_with_timespec): check conversion with locale
  modifier.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35835 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-29 08:28:09 +00:00
nobu 60683816be strftime.c: fix colon modifier.
partially borrowed from ext/date.

* strftime.c (rb_strftime_with_timespec): colons are valid only for
  'z' and must come just before it.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35834 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-29 08:28:04 +00:00
nobu 49479c2dcc strftime.c: linux style
* strftime.c (rb_strftime_with_timespec): fix indentation using linux
  style.  this file is not written in ruby-style.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35830 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-28 04:54:04 +00:00
nobu e0ffb9b59b * strftime.c (rb_strftime_with_timespec): fix carrir-up bug and
overwrite '+' with '-' if negative offset less than a hour.
  [ruby-core:44447][Bug #6323]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35399 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-19 07:33:55 +00:00
nobu 442fefc78a * strftime.c (rb_strftime_with_timespec): add an interim digit for
the timezone offset which is less than an hour.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35377 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-18 01:23:00 +00:00
nobu 43dbbefbdf * strftime.c (rb_strftime_with_timespec): fix padding of time zone
offset.  [ruby-dev:43287][Bug #4458]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35366 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-17 13:18:51 +00:00
naruse 23b2808693 * strftime.c (rb_strftime_with_timespec): get enc argument to specify
the encoding of the format. On Windows (at least Japanese Windows),
  Time#strftime("%Z") includes non ASCII in locale encoding (CP932).
  So convert locale to default internal. [ruby-core:39092] [Bug #5226]

* strftime.c (rb_strftime): ditto.

* strftime.c (rb_strftime_timespec): ditto.

* internal.h (rb_strftime_timespec): follow above.

* time.c (rb_strftime_alloc): ditto.

* time.c (strftimev): ditto.

* time.c (time_strftime): ditto.

* time.c (time_to_s): the resulted string of Time#to_s is always
  ascii only, so this should be US-ASCII.

* time.c (time_asctime): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33094 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-27 09:18:18 +00:00
ngoto cf310f9741 * strftime.c (NEEDS): avoid SEGV due to integer overflow in sparc-solaris2.10
and i686-linux.  fix [Bug #4456] [ruby-dev:43284]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32757 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-30 13:41:45 +00:00
yugui 8fa30bbd48 * strftime.c (rb_strftime_with_timespec): improved style consistency.
constified some variables.

* test/test_time.rb (TestTime#test_huge_precision): test for #4456.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31858 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-31 03:59:36 +00:00
naruse 63f39fcb40 * random.c (random_rand): remove unused variables.
* struct.c (rb_struct_define_without_accessor): ditto.

* strftime.c (rb_strftime_with_timespec): ditto.

* sprintf.c: ditto.

* time.c (time_asctime): remove useless GetTimeval().

* thread_pthread.c: cast to (void *) for %p.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31343 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-25 07:56:42 +00:00
matz 1df42597d1 cancel subversion backfire. sorry
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31046 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-07 08:44:45 +00:00
matz eb807d42ec * gc.c (rb_gc_set_params): allow GC parameter configuration by
environment variables.  based on a patch from funny-falcon at
  https://gist.github.com/856296, but honors safe level.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31044 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-07 08:39:39 +00:00
naruse 7bb73a0852 * strftime.c (STRFTIME): return 0 and ERANGE when precision is too
large. [ruby-dev:43284] fixes #4456

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31011 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-03 05:28:00 +00:00
akr 2418e5ca83 * strftime.c (rb_strftime_with_timespec): %G produces 4 digits.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30732 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-30 07:10:55 +00:00
akr ccc55bb7c3 * strftime.c: parenthesize macro arguments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30446 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-01 02:45:04 +00:00
akr 98c8e1cd91 * strftime.c (rb_strftime_with_timespec): suppress warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28916 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-08 01:08:27 +00:00
akr d06a6b22f5 * strftime.c (rb_strftime_with_timespec): fix precision handling for
%:z and %::z.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28608 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-10 12:43:54 +00:00
akr e51e679f14 * strftime.c: unused declarations removed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28592 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-09 13:33:39 +00:00
akr 85f10041b2 * strftime.c (rb_strftime_with_timespec): clear colons at unknown
directive.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28590 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-09 12:21:26 +00:00
akr 6f1c1b496e * strftime.c: don't call tzset. strftime.c doesn't depend on
the global timezone.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28589 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-09 12:04:26 +00:00
akr 9818dd26e5 unused code removed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28580 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-08 13:05:41 +00:00
akr a5d37d10a9 * strftime.c (rb_strftime_with_timespec): support %:z and %::z.
[ruby-dev:41841]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28572 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-07 21:07:01 +00:00
akr fbc42054e8 * time.c: less bignum allocations.
* strftime.c (rb_strftime_timespec): defined to avoid rational for
  nano second resolution time.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-31 12:34:31 +00:00
muraken e4d8dc5c46 * bignum.c, node.h, strftime.c, enc/trans/utf8_mac.trans: added explicit casts for supplessing warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27040 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-25 03:08:28 +00:00
naruse c121f78b9a * strftime.c: %l should be 1..12 instead of 0..12 [ruby-core:27072]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26029 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-06 14:55:22 +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 54370de9f4 * strftime.c: %Y format a year with 4 digits at least.
* lib/time.rb: format a year with 4 digits at least.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25906 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-24 11:34:45 +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
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
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 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
nobu 22cde7b682 * dir.c, dln.c, parse.y, re.c, ruby.c, sprintf.c, strftime.c,
string.c, util.c, variable.c: use strlcpy, memcpy and snprintf
  instead of strcpy, strncpy and sprintf.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-17 01:29:17 +00:00
nobu d1abc53721 * array.c, bignum.c, dln.c, error.c, gc.c, io.c, marshal.c,
numeric.c, pack.c, strftime.c, string.c, thread.c, transcode.c,
  transcode_data.h, util.c, variable.c, vm_dump.c,
  include/ruby/encoding.h, missing/crypt.c, missing/vsnprintf.c:
  suppress VC type warnings.  [ruby-core:22726]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22914 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-12 09:16:15 +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
akr 6fcaf92943 * strftime.c (rb_strftime): use locale insensitive functions for tr_TR
locale.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20944 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-23 10:13:11 +00:00
tadf 24a6416355 * strftime.c (rb_strftime): should add padding for %%.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20379 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-27 12:43:05 +00:00
matz b0f3bd5d25 * strftime.c (STRFTIME): use rb_strftime() recursively, instead of
platform's strftime().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20367 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-26 14:30:25 +00:00
matz 6099790621 * strftime.c (STRFTIME): should add padding for %[xXrR] etc.
[ruby-dev:37185] fix: #792

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-25 15:28:22 +00:00
matz 446ea127c3 * strftime.c (rb_strftime): should not swallow incomplete
formatter, e.g. "%E".  [ruby-dev:37170] fix: #787

* strftime.c (rb_strftime): clear flags before processing unknown
  formatter, e.g. "%i".  [ruby-dev:37180]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-25 14:24:47 +00:00
matz a689e57283 * strftime.c (rb_strftime): "%^P" should convert to upper case.
[ruby-dev:37180]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20353 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-25 04:42:11 +00:00
matz 15b183c218 * strftime.c (FMT): use "%0d" formatter for zero padding, not "%.d".
[ruby-dev:37168]  fix: #768

* strftime.c (rb_strftime): %s to use zero padding by default.
  [ruby-dev:37180]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20352 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-25 00:24:01 +00:00
shugo 361a713f96 * strftime.c (rb_strftime): The # flag should work with %a, %A, %b,
%B, and %h.  [ruby-dev:37162]
* test/ruby/test_time.rb (test_strftime): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20342 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-24 14:29:37 +00:00
shugo bf1d53e2e0 * strftime.c (rb_strftime): A width specifier for %t and %n should
work.  [ruby-dev:37160]
* test/ruby/test_time.rb (test_strftime): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20340 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-24 14:01:47 +00:00
shugo aa498028b2 * strftime.c (rb_strftime): The precision of %0N should be 9.
[ruby-dev:37156]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20339 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-24 13:10:07 +00:00
shugo 32aed81046 * strftime.c (rb_strftime): The default precision should be 1, not
0.  [ruby-dev:37155]
* test/ruby/test_time.rb (test_strftime): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20338 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-24 12:42:45 +00:00
nobu 893af1e3b6 * strftime.c (rb_strftime): suppressed warnings on cygwin.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19760 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-12 00:46:59 +00:00
yugui a8c3540b32 * dln.c: Ruby no longer supports Windows CE.
* eval.c: ditto.

* include/ruby/defines.h: ditto.

* include/ruby/win32.h: ditto.

* ruby.c: ditto.

* strftime.c: ditto.

* win32/Makefile.sub: ditto.

* win32/win32.c: ditto.

* ext/tk/extconf.rb: ditto.

* lib/fileutils.rb: ditto.

* test/fileutils/test_fileutils.rb: ditto.

* wince/*: removed.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19681 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-04 13:48:20 +00:00
yugui ae7ea3332b * dln.c: Ruby no longer supports MS-DOS.
* ext/sdbm/_sdbm.c: ditto.

* ext/sdbm/sdbm.h: ditto.

* gc.c: ditto.

* hash.c: ditto.

* include/ruby/defines.h: ditto.

* include/ruby/util.h: ditto.

* io.c: ditto.

* process.c: ditto.

* ruby.c: ditto.

* strftime.c: ditto.

* util.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19679 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-04 13:33:22 +00:00