Fix comments and implementation of channel_storage_duration to match
Rounding down minimum times in the implementation is not intuitive or
helpful for making the human-written config reflect the desired end
state.
Change-Id: I9e64bba34db88f340f828db5adb0dcc6b39d81be
diff --git a/aos/configuration.fbs b/aos/configuration.fbs
index 42c404e..317c100 100644
--- a/aos/configuration.fbs
+++ b/aos/configuration.fbs
@@ -147,7 +147,7 @@
// Length of the channels in nanoseconds. Every channel will have enough
// data allocated so that if data is published at the configured frequency,
- // this many seconds of messages will be available for fetchers.
+ // at least this many nanoseconds of messages will be available for fetchers.
channel_storage_duration:long = 2000000000 (id: 5);
}
diff --git a/aos/events/shm_event_loop.cc b/aos/events/shm_event_loop.cc
index a8e227e..05a1ad0 100644
--- a/aos/events/shm_event_loop.cc
+++ b/aos/events/shm_event_loop.cc
@@ -165,7 +165,7 @@
: channel_(channel),
lockless_queue_memory_(
channel,
- chrono::duration_cast<chrono::seconds>(chrono::nanoseconds(
+ chrono::ceil<chrono::seconds>(chrono::nanoseconds(
event_loop->configuration()->channel_storage_duration()))),
lockless_queue_(lockless_queue_memory_.memory(),
lockless_queue_memory_.config()),
@@ -350,7 +350,7 @@
: RawSender(event_loop, channel),
lockless_queue_memory_(
channel,
- chrono::duration_cast<chrono::seconds>(chrono::nanoseconds(
+ chrono::ceil<chrono::seconds>(chrono::nanoseconds(
event_loop->configuration()->channel_storage_duration()))),
lockless_queue_(lockless_queue_memory_.memory(),
lockless_queue_memory_.config()),