diff options
author | Sebastian <sebasjm@gmail.com> | 2023-06-05 11:24:25 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2023-06-05 11:24:25 -0300 |
commit | 6e7c88a62073082b28ef563561d08f56acc0b017 (patch) | |
tree | 555296c0255347c6efe3f6d0d3d0c0d360f0b86e /packages | |
parent | 75fdf6137fb465d6c6c72b997bc899459f3de66e (diff) | |
download | wallet-core-6e7c88a62073082b28ef563561d08f56acc0b017.tar.xz |
fix floor in times
Diffstat (limited to 'packages')
-rw-r--r-- | packages/taler-util/src/time.ts | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/packages/taler-util/src/time.ts b/packages/taler-util/src/time.ts index 717da7ecd..3d7d80485 100644 --- a/packages/taler-util/src/time.ts +++ b/packages/taler-util/src/time.ts @@ -81,7 +81,7 @@ export namespace TalerPreciseTimestamp { export function fromSeconds(s: number): TalerPreciseTimestamp { return { t_s: Math.floor(s), - off_us: (s - Math.floor(s)) / 1000 / 1000, + off_us: Math.floor((s - Math.floor(s)) / 1000 / 1000), }; } @@ -89,7 +89,7 @@ export namespace TalerPreciseTimestamp { return { t_s: Math.floor(ms / 1000), off_us: Math.floor((ms - Math.floor(ms / 100) * 1000) * 1000), - } + }; } } @@ -254,7 +254,7 @@ export namespace Duration { }; } return { - d_ms: d.d_us / 1000, + d_ms: Math.floor(d.d_us / 1000), }; } @@ -371,7 +371,7 @@ export namespace AbsoluteTime { } const offsetUs = t.off_us ?? 0; return { - t_ms: t.t_s * 1000 + offsetUs / 1000, + t_ms: t.t_s * 1000 + Math.floor(offsetUs / 1000), [opaque_AbsoluteTime]: true, }; } |