feidee_utils 0.0.4.7 → 0.0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 26b9e39c2cd9ea69a6183b406b9baae7877afe5e
4
- data.tar.gz: 44ad306d6594bd09d1c6442bcfdc11331ee67509
3
+ metadata.gz: 2c84bce11a2b8623e64ce188aedc8c1697991745
4
+ data.tar.gz: e7b56117a0c220ceb1d3243b2ef83e01d7301ca0
5
5
  SHA512:
6
- metadata.gz: 854d3923620bf6518e22de9acf89db1de67a9a664d4d81189471dd6bb57a143f7eb9c39c869396a50f3d7cde18c9d737f70954d74c49a5b082a5a837e93e2c54
7
- data.tar.gz: 33d9fe851f98087c7a675904d8d2b21d801beac6764bcacf8c719c6c4f238b43149024ee71593b17989e946197cf717701fe4946ae1844a4c9ac9f5295514bea
6
+ metadata.gz: 032d2acefd6132ed8c68aeb412dbc93f06d0d05752c45b2449a5fa882027a02ab54c0fcd74ed7b63fc036babd9e69c27a3732af0c8c3b0533d10dc5391bf4084
7
+ data.tar.gz: eec26fb195db29ab8d26ba82b9a1f11e8c9905bbdd95c70d08f40e7f048878cbe9c35add6645f42f52007949c221e495ad57ba982c4485926fa7d99de9f12041
@@ -16,10 +16,15 @@ module FeideeUtils
16
16
  # Note utc_to_local() would return 2017-12-09 11:30 UTC, of which the
17
17
  # timezone is different from physical timezone CST. The actual timezone
18
18
  # has been lost when the timestamp was written to database.
19
- def timestamp_to_time num
19
+ def timestamp_to_time_slow num
20
20
  AssumedTimezone.utc_to_local(Time.at(num / 1000.0, num % 1000).utc)
21
21
  end
22
22
 
23
+ AssumedTimezoneAdjust = 8 * 3600 # 8 hours difference between CST and UTC.
24
+ def timestamp_to_time num
25
+ Time.at(num / 1000.0 + AssumedTimezoneAdjust, num % 1000).utc
26
+ end
27
+
23
28
  def to_bigdecimal number
24
29
  # Be aware of the precision lost from String -> Float -> BigDecimal.
25
30
  BigDecimal.new(number, 12).round(2)
@@ -133,15 +133,15 @@ module FeideeUtils
133
133
  9 => :negative_initial_balance,
134
134
  })
135
135
 
136
- computed :created_at do
136
+ def created_at
137
137
  timestamp_to_time(raw_created_at)
138
138
  end
139
139
 
140
- computed :modified_at do
140
+ def modified_at
141
141
  timestamp_to_time(raw_modified_at)
142
142
  end
143
143
 
144
- computed :trade_at do
144
+ def trade_at
145
145
  timestamp_to_time(raw_trade_at)
146
146
  end
147
147
 
@@ -1,3 +1,3 @@
1
1
  module FeideeUtils
2
- VERSION = '0.0.4.7'
2
+ VERSION = '0.0.5.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: feidee_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4.7
4
+ version: 0.0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Liqing Muyi