Yasuhiro Matsumoto
1167fd1ae4
use round for llround. some platform (ex: mingw32) doesn't have llround.
2015-07-09 11:02:34 +09:00
Yukihiro "Matz" Matsumoto
6a796cb4cc
Added a check for 64 bit time_t overflow; based on a patch from @kext; close #2836
2015-06-17 09:19:09 +09:00
Lukas Joeressen
47c61cf502
Changed llrint to llround
2015-06-16 09:24:27 +02:00
Lukas Joeressen
95fa22a65c
Rounding errors could make time_alloc imprecise
2015-06-15 15:03:44 +02:00
cremno
c47cc0c3bb
call C11's timespec_get()
...
gettimeofday() is an obsolescent POSIX function which may be removed in
a future version. POSIX recommends using clock_gettime() (also POSIX)
instead, but it isn't available on OS X or Windows (at least with MSVC
and older MinGW versions).
Whereas timespec_get() is part of ISO C11 and mruby uses some small
other C11 features too. It isn't universally available yet either, but
it might be in the future. And Visual C++ 2015 implements it! Since
mruby strives for ISO C and not POSIX compatibility, I think it's a
reasonable choice.
TIME_UTC is used instead of __STDC_VERSION__, because if TIME_UTC is
defined, then most likely timespec_get() is too. This isn't true in case
of __STDC_VERSION__ (see MSVC).
2015-03-22 22:52:12 +01:00
Yukihiro "Matz" Matsumoto
b4cc962c3a
add similar range check for tm->usec as well
2014-10-03 14:58:59 +09:00
Yukihiro "Matz" Matsumoto
95b3a70291
always check range before casting time_t to mrb_int
2014-10-03 14:57:22 +09:00
Yukihiro "Matz" Matsumoto
88d14e03d0
time_t may overflow mrb_int when word boxing is used
2014-10-03 11:10:09 +09:00
take_cheeze
b3d0585fe5
Add API mrb_data_init to initialize MRB_TT_DATA tagged instance.
2014-08-20 22:42:35 +09:00
dycoon
e7249e4590
timer on windows bug fixed.
2014-08-09 21:40:52 +09:00
Yukihiro "Matz" Matsumoto
0878900fda
Time#to_i and Time#usec should care about mrb_int overflow on MRB_INT16; ref #2495
2014-08-03 20:36:20 +09:00
take_cheeze
8106760077
Use MRB_ARGS_ARG(n, o) instead of MRB_ARGS_REQ(n) | MRB_ARGS_OPT(o).
2014-07-02 21:11:12 +09:00
Yukihiro "Matz" Matsumoto
e749267909
time overflow check; ref #2337
2014-07-02 10:28:10 +09:00
take_cheeze
77047b5ed4
Test all ISO defined classes direct superclass except Object class.
...
Move mrbgems ISO direct superclass test to `superclass.rb`.
Skips test if class isn't defined.
Close #2332 .
2014-06-15 17:07:01 +09:00
take_cheeze
d386b35337
Fix Time.at args spec.
2014-06-09 16:34:04 +09:00
kyab
4a05dce4a3
pacify MSVC warnings for time.c
2014-05-09 23:38:05 +09:00
take_cheeze
f0154d6e3a
Remove Time defined check in test.
2014-05-07 21:21:18 +09:00
mattn
0b5fe0ad6f
Fix build on mingw32/64: struct timeval isn't defined in default. See: 642477ef6a
2014-05-07 10:18:57 +09:00
take_cheeze
7bab3d0bb2
Implement day of week methods.
2014-05-05 22:41:16 +09:00
windwiny
642477ef6a
Update time.c
...
miss __MINGW32__ macro check
2014-05-02 22:28:09 +08:00
cremno
06a946abb2
mruby-time: fix check of mktime's return value
...
>If the calendar time cannot be represented, the function returns the
value (time_t)(-1).
http://www.iso-9899.info/n1256.html#7.23.2.3p3
2014-04-13 16:43:13 +02:00
cremno
8b5cbe2f33
mruby-time: remove unnecessary tzset call
...
The gem doesn't use the global variables and:
>Local timezone information is used as though localtime() calls tzset().
http://pubs.opengroup.org/onlinepubs/9699919799/functions/localtime.html
2014-04-13 16:39:16 +02:00
take_cheeze
c73f8d4def
move summary of mrbgems in default gembox to its spec
2014-03-17 00:34:24 +09:00
Mitchell Hashimoto
3843a286b6
Don't redefine timeval on MingW64 environments
2014-03-13 23:23:28 -07:00
mattn
a9ac721e38
Fix build on mingw32
2014-03-06 19:57:22 +09:00
unak
561c2a1581
fixed broken gettimeofday implementation for Windows
...
small, but critical typo :)
2014-03-06 12:40:48 +09:00
Yukihiro "Matz" Matsumoto
1bba236cb2
Merge pull request #1812 from cremno/time-3
...
mruby-time: add gettimeofday(2) for Windows
2014-03-06 01:43:06 +09:00
cremno
890ef11fde
mruby-time: add gettimeofday(2) for Windows
2014-03-05 17:13:13 +01:00
cremno
69b231ece5
mruby-time: fix indentation in mrb_time_asctime
2014-03-05 17:08:51 +01:00
cremno
96d3bc2811
mruby-time: store timezone name directly
2014-03-05 17:08:51 +01:00
cremno
9b3033bb53
mruby-time: timezone_names should be const
2014-03-05 17:08:50 +01:00
cremno
e34b69f582
mruby-time: store strings directly instead of pointers to them
2014-03-05 17:08:44 +01:00
cremno
333840ba61
mruby-time: mrb_time_type should be const
2014-03-05 16:53:42 +01:00
cremno
f9c88e9c68
mruby-time: fix two tiny typos in comments
2014-03-05 16:53:41 +01:00
cremno
c088797107
mruby-time: rearrange header order
2014-03-05 16:53:41 +01:00
cremno
bf48f5ec87
mruby-time: remove trailing whitespace
2014-03-05 16:53:40 +01:00
cubicdaiya
67de10bfcb
use C style comments instead of C++ style comments
...
According to CONTRIBUTING.md,
Don't use C++ style comments
/* This is the prefered comment style */
Use C++ style comments only for temporary comment e.g. commenting out some code lines.
2014-03-01 03:31:45 +09:00
cubicdaiya
96c24b0a37
small-optimization2 for mrb_time_zone
...
mrb_str_new_static is more efficient than mrb_str_new in this case.
2014-02-25 15:24:02 +09:00
cubicdaiya
985e4892cf
small-optimization for mrb_time_zone
...
Using mrb_str_new instead of mrb_str_new_cstr
2014-02-25 15:03:35 +09:00
Yukihiro "Matz" Matsumoto
4a2c37df93
made mrb_define_class to return existing class, with heavy refactoring
2014-02-08 13:44:31 +09:00
Yukihiro "Matz" Matsumoto
b12d9a8700
remove alloc from Time class
2013-08-15 01:37:03 +09:00
Yukihiro "Matz" Matsumoto
b225e4cc82
redesign mruby/data.h API; use DATA_PTR() for raw data pointer, DATA_GET_PTR() to type safe retrieval (TypeError will be raised), DATA_CHECK_GET_PTR() to get nil if type mismatched
2013-08-15 01:33:36 +09:00
Yukihiro "Matz" Matsumoto
b7d6b4d0ce
define allocation method for Time class; close #1474
2013-08-14 16:50:52 +09:00
Blaž Hrastnik
ac4a6d35b9
muby-time: use mrb_free directly
2013-08-05 18:55:55 +02:00
Tomoyuki Sahara
116f75a8ce
"spec.author" is better for single-author gems.
...
"spec.author=" expects a String represents a single author.
"spec.authors=" expects an Array which is a list of multiple authors.
http://guides.rubygems.org/specification-reference/
2013-07-23 10:09:24 +09:00
Tomoyuki Sahara
4ab62e3f81
fix typo: Tus -> Tue.
2013-06-18 13:24:16 +09:00
kimu_shu
e720782f81
Add MRB_WORD_BOXING mode (represent mrb_value as a word)
2013-05-26 10:09:17 +09:00
Yukihiro "Matz" Matsumoto
1b31cbfbc8
add new macro MRB_ARGS_ARG(n1,n2) to specify required and optional arugments at once
2013-04-25 11:53:36 +09:00
Yukihiro "Matz" Matsumoto
30d580ecbc
rename every ARGS_XXX to MRB_ARGS_XXX; ref #1206
2013-04-25 09:47:36 +09:00
Yukihiro "Matz" Matsumoto
75f5535c4f
rename DATA API: mrb_get_datatype -> mrb_data_get_ptr; mrb_check_datatype -> mrb_data_check_and_get
2013-04-04 04:30:39 +09:00