DateFormatter only provide second level precision for absl format
This is because two problems:
-
time_tis used when calling theabsl::FormatTime. Thetime_tonly provide second level precision. - The time cache. The cache is updated in second level. And the code will get the cached string and replace sub-second part to sub-second of current timepoint. But the code only handle the specifier
%fand don't handle absl format (actually it's not easy to handle it, this means we maybe shouldn't use time cache for dynamic format string).
cc @dio @mattklein123
START_TIME can be customized using a format string.
IIUC, the doc does not mention support the fractional second format in absl::FormatTime, instead it only mention the %f format.
So, it's safe to cache by seconds, thoughts?
The default format that used by Envoy is %Y-%m-%dT%H:%M:%E3SZ but current DateFormtter even cannot support it correctly.
And the DateFormatter has tell it could support absl::FormatTime in its comments.
https://github.com/envoyproxy/envoy/blob/9537fce85d4f919d4b16de280f0ddf5b0130b8b5/source/common/common/utility.h#L43
So, I am inclined this is a code bug rather than a users-aware bug? If someone want to use this utility class, he may get unexpected result.
This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged "help wanted" or "no stalebot" or other activity occurs. Thank you for your contributions.
This issue has been automatically closed because it has not had activity in the last 37 days. If this issue is still valid, please ping a maintainer and ask them to label it as "help wanted" or "no stalebot". Thank you for your contributions.