feidee_utils 0.0.4.7 → 0.0.5.0
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 +4 -4
- data/lib/feidee_utils/record/utils.rb +6 -1
- data/lib/feidee_utils/transaction.rb +3 -3
- data/lib/feidee_utils/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c84bce11a2b8623e64ce188aedc8c1697991745
|
4
|
+
data.tar.gz: e7b56117a0c220ceb1d3243b2ef83e01d7301ca0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
|
-
|
136
|
+
def created_at
|
137
137
|
timestamp_to_time(raw_created_at)
|
138
138
|
end
|
139
139
|
|
140
|
-
|
140
|
+
def modified_at
|
141
141
|
timestamp_to_time(raw_modified_at)
|
142
142
|
end
|
143
143
|
|
144
|
-
|
144
|
+
def trade_at
|
145
145
|
timestamp_to_time(raw_trade_at)
|
146
146
|
end
|
147
147
|
|
data/lib/feidee_utils/version.rb
CHANGED