File tree 4 files changed +5
-6
lines changed
pragma-node/src/handlers/entries
4 files changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ impl From<crate::Entry> for Entry {
27
27
pair_id : entry. pair_id ,
28
28
publisher : entry. publisher ,
29
29
source : entry. source ,
30
- timestamp : entry. timestamp . and_utc ( ) . timestamp_millis ( ) as u64 ,
30
+ timestamp : entry. timestamp . and_utc ( ) . timestamp ( ) as u64 ,
31
31
price : entry. price . to_u128 ( ) . unwrap_or ( 0 ) , // change default value ?
32
32
}
33
33
}
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ pub async fn get_entry(
34
34
// Construct pair id
35
35
let pair_id = currency_pair_to_pair_id ( & pair. 0 , & pair. 1 ) ;
36
36
37
- let now = chrono:: Utc :: now ( ) . timestamp_millis ( ) as u64 ;
37
+ let now = chrono:: Utc :: now ( ) . timestamp ( ) as u64 ;
38
38
39
39
let timestamp = if let Some ( timestamp) = params. timestamp {
40
40
timestamp
@@ -56,7 +56,6 @@ pub async fn get_entry(
56
56
57
57
let is_routing = params. routing . unwrap_or ( false ) ;
58
58
59
- // Validate given timestamp
60
59
if timestamp > now {
61
60
return Err ( EntryError :: InvalidTimestamp ) ;
62
61
}
@@ -84,7 +83,7 @@ fn adapt_entry_to_entry_response(
84
83
) -> GetEntryResponse {
85
84
GetEntryResponse {
86
85
pair_id,
87
- timestamp : entry. time . and_utc ( ) . timestamp_millis ( ) as u64 ,
86
+ timestamp : entry. time . and_utc ( ) . timestamp ( ) as u64 ,
88
87
num_sources_aggregated : entry. num_sources as usize ,
89
88
price : format ! (
90
89
"0x{}" ,
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ pub async fn get_ohlc(
31
31
// Construct pair id
32
32
let pair_id = currency_pair_to_pair_id ( & pair. 0 , & pair. 1 ) ;
33
33
34
- let now = chrono:: Utc :: now ( ) . timestamp_millis ( ) as u64 ;
34
+ let now = chrono:: Utc :: now ( ) . timestamp ( ) as u64 ;
35
35
36
36
let timestamp = if let Some ( timestamp) = params. timestamp {
37
37
timestamp
Original file line number Diff line number Diff line change @@ -143,7 +143,7 @@ pub struct GetEntryParams {
143
143
impl Default for GetEntryParams {
144
144
fn default ( ) -> Self {
145
145
Self {
146
- timestamp : Some ( chrono:: Utc :: now ( ) . timestamp_millis ( ) as u64 ) ,
146
+ timestamp : Some ( chrono:: Utc :: now ( ) . timestamp ( ) as u64 ) ,
147
147
interval : Some ( Interval :: default ( ) ) ,
148
148
routing : Some ( false ) ,
149
149
aggregation : Some ( AggregationMode :: default ( ) ) ,
You can’t perform that action at this time.
0 commit comments