diff --git a/CHANGELOG.md b/CHANGELOG.md index 2fafd72..9730b83 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- Fix loss of precision during timestamp convert + ## [0.2.5] - 2022-01-27 ### Fixed diff --git a/html/current.html b/html/current.html index 2547ea5..2010b55 100644 --- a/html/current.html +++ b/html/current.html @@ -36,7 +36,7 @@ data: "updated_at", render: function (data, type, row, meta) { if (type == 'display') { - return DATE_FORMATTER.format(new Date(data * 1000)) + return DATE_FORMATTER.format(new Date(data)) } else { return data } diff --git a/html/logs.html b/html/logs.html index 860520a..27bd090 100644 --- a/html/logs.html +++ b/html/logs.html @@ -99,7 +99,7 @@ data: "ts", render: function (data, type, row, meta) { if (type == 'display') { - return DATE_FORMATTER.format(new Date(data * 1000)) + return DATE_FORMATTER.format(new Date(data)) } else { return data } diff --git a/src/main.rs b/src/main.rs index 94156dd..ed4022e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -107,7 +107,7 @@ async fn status(db: web::Data) -> impl Responder { let ts: chrono::DateTime = rows[0].get("ts"); let event: BatchEvent = rows[0].get("event"); let result: StatusResponse = StatusResponse { - ts: ts.timestamp(), + ts: ts.timestamp_millis(), event: event.to_string(), }; HttpResponse::Ok().json(result) @@ -134,7 +134,7 @@ async fn current(db: web::Data) -> impl Responder { let build_reasons: String = row.get("build_reasons"); let elapsed: i32 = row.get("elapsed"); result.push(CurrentResponse { - updated_at: updated_at.timestamp(), + updated_at: updated_at.timestamp_millis(), pkgbase: pkgbase, status: build_status.to_string(), reasons: build_reasons, @@ -169,7 +169,7 @@ async fn logs(db: web::Data) -> impl Responder { let memory: pg_bigdecimal::PgNumeric = row.get("memory"); let memory_bd: bigdecimal::BigDecimal = memory.n.unwrap(); results.push(LogsResponse { - ts: ts.timestamp(), + ts: ts.timestamp_millis(), pkgbase: pkgbase, pkg_version: pkg_version, maintainer: maintainer, @@ -207,7 +207,7 @@ async fn get_pkg( let memory: pg_bigdecimal::PgNumeric = row.get("memory"); let memory_bd: bigdecimal::BigDecimal = memory.n.unwrap(); results.push(LogsResponse { - ts: ts.timestamp(), + ts: ts.timestamp_millis(), pkgbase: pkgbase, pkg_version: pkg_version, maintainer: maintainer,