mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-20 07:24:41 +02:00
Use datatype monotonic_t instead of double to keep track of time
The time is stored in a signed 64 bit integer with nanosecond accuracy. This eliminates the possibility of floating-point inaccuracies. `monotonic_t` can currently hold values large enough to work correctly for more than 200 years into the future. Using a typedef instead of directly using `int64_t` everywhere will also allow easily changing the datatype in the future should the need arise for more precise or bigger time values.
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
|
||||
#pragma once
|
||||
#include "data-types.h"
|
||||
#include "monotonic.h"
|
||||
|
||||
typedef struct {
|
||||
unsigned char action, transmission_type, compressed, delete_action;
|
||||
@@ -50,7 +51,7 @@ typedef struct {
|
||||
|
||||
ImageRef *refs;
|
||||
size_t refcnt, refcap;
|
||||
double atime;
|
||||
monotonic_t atime;
|
||||
size_t used_storage;
|
||||
} Image;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user