30template<
typename Rep,
typename Period>
33 using boost::chrono::duration;
34 using boost::chrono::ceil;
35 using User_duration = duration<Rep, Period>;
37 assert(dur.count() >= 0);
38 return (dur == User_duration::max()) ? Fine_duration::max() : ceil<Fine_duration>(dur);
41template<
typename Rep,
typename Period>
44 using boost::chrono::duration;
45 using boost::chrono::ceil;
46 using User_duration = duration<Rep, Period>;
48 assert(dur.count() >= 0);
49 return (dur == User_duration::max())
51 : (Fine_clock::now() + ceil<Fine_duration>(dur));
59 constexpr char SEP =
'\\';
61 constexpr char SEP =
'/';
71 const auto path_sz = path.size();
74 const auto path_ptr = path.data();
75 for (
auto path_search_ptr = path_ptr + path_sz - 1;
76 path_search_ptr >= path_ptr; --path_search_ptr)
78 if ((*path_search_ptr) == SEP)
80 path.remove_prefix((path_search_ptr - path_ptr) + 1);
112#define FLOW_UTIL_WHERE_AM_I_FROM_ARGS(ARG_file, ARG_function, ARG_line) \
113 ARG_file << ':' << ARG_function << '(' << ARG_line << ')'
131#define FLOW_UTIL_WHERE_AM_I_FROM_ARGS_TO_ARGS(ARG_file, ARG_function, ARG_line) \
132 ::flow::util::get_last_path_segment(ARG_file), ':', ARG_function, '(', ARG_line, ')'
169#define FLOW_UTIL_WHERE_AM_I_LITERAL(ARG_function) \
170 FLOW_UTIL_WHERE_AM_I_LITERAL_IMPL_OUTER(ARG_function, __LINE__)
182#define FLOW_UTIL_WHERE_AM_I_LITERAL_IMPL_OUTER(ARG_function, ARG_line) \
183 FLOW_UTIL_WHERE_AM_I_LITERAL_IMPL_INNER(ARG_function, ARG_line)
194#define FLOW_UTIL_WHERE_AM_I_LITERAL_IMPL_INNER(ARG_function, ARG_line) \
195 __FILE__ ": " #ARG_function "(" #ARG_line ")"
Flow module containing miscellaneous general-use facilities that don't fit into any other Flow module...
constexpr String_view get_last_path_segment(String_view full_path)
Helper for FLOW_UTIL_WHERE_AM_I() that, given a pointer/length of a string in memory containing a pat...
Fine_time_pt chrono_duration_from_now_to_fine_time_pt(const boost::chrono::duration< Rep, Period > &dur)
Helper that takes a non-negative duration of arbitrary precision/period and converts it to Fine_durat...
Fine_duration chrono_duration_to_fine_duration(const boost::chrono::duration< Rep, Period > &dur)
Helper that takes a non-negative duration of arbitrary precision/period and converts it to Fine_durat...
Basic_string_view< char > String_view
Commonly used char-based Basic_string_view. See its doc header.
Fine_clock::duration Fine_duration
A high-res time duration as computed from two Fine_time_pts.
Fine_clock::time_point Fine_time_pt
A high-res time point as returned by Fine_clock::now() and suitable for precise time math in general.