trilogy 2.12.0 → 2.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9159fca1baf9c5d9f2a23ef0850ca007ba4f0fc2d1f70ed678bde01dedb0e9d8
4
- data.tar.gz: f8239356e08a8fe724f0ae3c2fc2d628eed88a9a15a6ab1ef5b7b696bec6a8b6
3
+ metadata.gz: fa7792809ccd732921671b43f102631eb31f9731a1e934e41dbb43fe726d892e
4
+ data.tar.gz: df25e12d20ba446535f63c6cf05b18a929d9734383670bf407f3f34b42b50c54
5
5
  SHA512:
6
- metadata.gz: cec828b0440de7874f7e2df56738e8e99b024649a2d40c256ea955b652ef9375a345bc0021c4ce083c7f0fb4ce56b0cfd84524ce4d055c0d934ae702399b4f79
7
- data.tar.gz: a92b013118f91b5c7ff34b9cf3d0cc4eca2bf64199ced3191fc5f17ea9f450e2c2a860d20ed82acc659a2b057e7bf366a31525f8d8fee1bede64b794c2f1a66e
6
+ metadata.gz: f7b9a4b3ea7423aadbe0af53c01409728f418640bb08b8e2703bdc629d5ff8e2e80c0999da00dbbe4a9a8cc986a60cba1a32dddcbe72c0063e360fb36a0989d3
7
+ data.tar.gz: 7533b821a81f3fde8d51d3da0f5802c6d71d4a5b80e1b363dfc3caa711ba0b79f9f81d2a7ccce8557560e4f517743b22d5d70b06115ba0198bf7e6be91ed25a9
@@ -7,7 +7,7 @@
7
7
 
8
8
  #define CAST_STACK_SIZE 64
9
9
 
10
- static ID id_BigDecimal, id_Integer, id_new;
10
+ static ID id_BigDecimal, id_Integer, id_new, id_local;
11
11
 
12
12
  static const char *ruby_encoding_name_map[] = {
13
13
  [TRILOGY_ENCODING_ARMSCII8] = NULL,
@@ -99,23 +99,20 @@ static time_t civil_to_epoch_utc(int year, int month, int day, int hour, int min
99
99
  static VALUE trilogy_make_time(int year, int month, int day, int hour, int min, int sec,
100
100
  int usec, int local)
101
101
  {
102
- struct timespec ts;
103
102
  if (local) {
104
- struct tm tm = {
105
- .tm_year = year - 1900,
106
- .tm_mon = month - 1,
107
- .tm_mday = day,
108
- .tm_hour = hour,
109
- .tm_min = min,
110
- .tm_sec = sec,
111
- .tm_isdst = -1,
112
- };
113
- ts.tv_sec = mktime(&tm);
114
- } else {
115
- ts.tv_sec = civil_to_epoch_utc(year, month, day, hour, min, sec);
103
+ return rb_funcall(
104
+ rb_cTime, id_local, 7,
105
+ INT2NUM(year), INT2NUM(month), INT2NUM(day),
106
+ INT2NUM(hour), INT2NUM(min), INT2NUM(sec),
107
+ INT2NUM(usec / 1000)
108
+ );
116
109
  }
117
- ts.tv_nsec = (long)usec * 1000;
118
- return rb_time_timespec_new(&ts, local ? INT_MAX : INT_MAX - 1);
110
+
111
+ struct timespec ts = {
112
+ .tv_sec = civil_to_epoch_utc(year, month, day, hour, min, sec),
113
+ .tv_nsec = (long)usec * 1000,
114
+ };
115
+ return rb_time_timespec_new(&ts, INT_MAX - 1);
119
116
  }
120
117
 
121
118
  // Byte-arithmetic datetime parsing helpers (inspired by Go's go-sql-driver/mysql)
@@ -398,4 +395,5 @@ void rb_trilogy_cast_init(void)
398
395
  id_BigDecimal = rb_intern("BigDecimal");
399
396
  id_Integer = rb_intern("Integer");
400
397
  id_new = rb_intern("new");
398
+ id_local = rb_intern("local");
401
399
  }
@@ -1,3 +1,3 @@
1
1
  class Trilogy
2
- VERSION = "2.12.0"
2
+ VERSION = "2.12.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trilogy
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.12.0
4
+ version: 2.12.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub Engineering
@@ -87,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
87
87
  - !ruby/object:Gem::Version
88
88
  version: '0'
89
89
  requirements: []
90
- rubygems_version: 3.6.9
90
+ rubygems_version: 4.0.6
91
91
  specification_version: 4
92
92
  summary: A friendly MySQL-compatible library for Ruby, binding to libtrilogy
93
93
  test_files: []