| Age | Commit message (Collapse) | Author |
|
'stdio.h' is included in 'mruby.h' ('mrbconf.h').
However, keep 'stdio.h' used by mruby-test.
|
|
|
|
Silence the following warnings:
```
/mruby/mrbgems/mruby-time/src/time.c:260:55: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if ((MRB_INT_MAX > MRB_TIME_MAX && i > 0 && i > MRB_TIME_MAX) ||
^
```
|
|
|
|
Silence the following warnings:
```
/mruby/mrbgems/mruby-time/src/time.c:871:15: warning: result of comparison of constant 9223372036854775807 with expression of type 'time_t' (aka 'long') is always false [-Wtautological-constant-out-of-range-compare]
if (tm->sec > MRB_INT_MAX || tm->sec < MRB_INT_MIN) {
~~~~~~~ ^ ~~~~~~~~~~~
/mruby/mrbgems/mruby-time/src/time.c:871:40: warning: result of comparison of constant -9223372036854775808 with expression of type 'time_t' (aka 'long') is always false [-Wtautological-constant-out-of-range-compare]
if (tm->sec > MRB_INT_MAX || tm->sec < MRB_INT_MIN) {
~~~~~~~ ^ ~~~~~~~~~~~
/mruby/mrbgems/mruby-time/src/time.c:887:16: warning: result of comparison of constant 9223372036854775807 with expression of type 'time_t' (aka 'long') is always false [-Wtautological-constant-out-of-range-compare]
if (tm->usec > MRB_INT_MAX || tm->usec < MRB_INT_MIN) {
~~~~~~~~ ^ ~~~~~~~~~~~
/mruby/mrbgems/mruby-time/src/time.c:887:42: warning: result of comparison of constant -9223372036854775808 with expression of type 'time_t' (aka 'long') is always false [-Wtautological-constant-out-of-range-compare]
if (tm->usec > MRB_INT_MAX || tm->usec < MRB_INT_MIN) {
~~~~~~~~ ^ ~~~~~~~~~~~
```
|
|
Silence the following warning:
```
/mruby/mrbgems/mruby-time/src/time.c:258:60: warning: result of comparison of constant -9223372036854775808 with expression of type 'mrb_int' (aka 'int') is always false [-Wtautological-constant-out-of-range-compare]
if ((mrb_time_int)i > MRB_TIME_MAX || MRB_TIME_MIN > i) {
~~~~~~~~~~~~ ^ ~
```
|
|
|
|
|
|
The binary sizes (gems are only `mruby-bin-mruby`) are reduced slightly in
my environment than before the introduction of new specifiers/modifiers
(5116789a) with this change.
------------+-------------------+-------------------+--------
BINARY | BEFORE (5116789a) | AFTER (This PR) | RATIO
------------+-------------------+-------------------+--------
mruby | 593416 bytes | 593208 bytes | -0.04%
libmruby.a | 769048 bytes | 767264 bytes | -0.23%
------------+-------------------+-------------------+--------
BTW, I accidentally changed `tasks/toolchains/visualcpp.rake` at #4613,
so I put it back.
|
|
Warnings:
- If `MRB_TIME_T_UINT` is defined, the compiler issues a warning with an
integer comparison of different signs.
- It is mentioned that the `usec` variable passed to the
`mrb_to_time_t()` function may not be initialized
|
|
Use own implementation to calculate UTC offset on Visual Studio 2015 or
earlier or MinGW because `strftime("%z")` on these environments does not
conform C99.
|
|
strftime() on Windows returns locale encoding time zone for "%z" even
if MSDN says "%z" is "The offset from UTC in ISO 8601 format; no
characters if time zone is unknown" in MSDN:
https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strftime-wcsftime-strftime-l-wcsftime-l?view=vs-2019
So we need to convert encoding of string from strftime().
|
|
- `Time.local` and `Time.utc` are able to use with `MRB_INT16 + MRB_WITHOUT_FLOAT`.
- `time_t` is converted directly from the Ruby object.
- `time + sec` and` time - sec` are not affected by the precision of `mrb_float`.
Similarly, calculations are possible with `MRB_INT16 + MRB_WITHOUT_FLOAT`.
|
|
|
|
As a side effect, `mrb_time_at()` now takes `mrb_int` instead of
`double` as time arguments.
|
|
|
|
The purpose is to clarify the error if there is a needed/conflicts
configuration at compile time.
|
|
|
|
|
|
For the following reasons:
- Ruby compatibility.
- Add UTC offset (time zone informations was not included by #4433).
- More readable.
Example:
Before this patch:
p Time.gm(2003,4,5,6,7,8,9) #=> Sat Apr 5 06:07:08 2003
p Time.local(2013,10,28,16,27,48) #=> Mon Oct 28 16:27:48 2013
After this patch:
p Time.gm(2003,4,5,6,7,8,9) #=> 2003-04-05 06:07:08 UTC
p Time.local(2013,10,28,16,27,48) #=> 2013-10-28 16:27:48 +0900
Implementation:
I use `strftime(3)` because UTC offset can be added and program size become
smaller than the other implementations (using `sprintf(3)`, self conversion
etc) in my environment.
|
|
- A leading charactor for day is space.
- Time zone does not included.
Before this patch:
Time.gm(1982,3,4,5,6,7).asctime #=> "Thu Mar 04 05:06:07 UTC 1982"
After this patch:
Time.gm(1982,3,4,5,6,7).asctime #=> "Thu Mar 4 05:06:07 1982"
|
|
|
|
To avoid memory leak from `time_update_datetime`.
|
|
|
|
|
|
|
|
Android bionic defines `TIME_UTC` but does not provide `timespec_get`.
|
|
mruby-time: support time_t is uint
|
|
|
|
|
|
On some platform and timezone it is a valid time spec.
|
|
|
|
|
|
'mrb_int' to 'int', possible loss of data
|
|
conversion from 'mrb_int' to 'double', possible loss of data
|
|
|
|
This change was suggested by Akira Kakuto.
|
|
|
|
|
|
ref #3492 #3515 #3517
|
|
|
|
|
|
|
|
|
|
And some cases should raise FloatDomainError
|
|
This issue was reported by https://hackerone.com/volc
|
|
|
|
|
|
The function used to return NULL on error, but not checked in the
caller site.
|
|
|