52 asm volatile(
"" :
"+r,m"(s),
"+r,m"(n) : :
"memory");
53 ::explicit_bzero(s, n);
68 ::clock_gettime(CLOCK_MONOTONIC, &t);
73 struct timespec t { 0, 0 };
74 ::clock_gettime(CLOCK_REALTIME, &t);
79 constexpr uint64_t ms_per_sec = 1'000UL;
80 constexpr uint64_t ns_per_ms = 1'000'000UL;
81 struct timespec t { 0, 0 };
82 ::clock_gettime(CLOCK_MONOTONIC, &t);
83 return static_cast<uint64_t
>( t.tv_sec ) * ms_per_sec +
84 static_cast<uint64_t
>( t.tv_nsec ) / ns_per_ms;
88 struct timespec t { 0, 0 };
89 ::clock_gettime(CLOCK_REALTIME, &t);
90 return static_cast<uint64_t
>( t.tv_sec );
94 return std::to_string(
tv_sec) +
"s + " + std::to_string(
tv_nsec) +
"ns";
98 std::time_t t0 =
static_cast<std::time_t
>(
tv_sec);
100 if(
nullptr == ::gmtime_r(&t0, &tm_0) ) {
102 if( space_separator ) {
105 return "1970-01-01Z";
108 if( space_separator ) {
109 return "1970-01-01 00:00:00";
111 return "1970-01-01T00:00:00Z";
121 if( muteTime || ( 0 == tm_0.tm_hour && 0 == tm_0.tm_min && 0 == tm_0.tm_sec && 0 ==
tv_nsec ) ) {
122 p = ::strftime(b,
sizeof(b),
"%Y-%m-%d", &tm_0);
124 if( space_separator ) {
125 p = ::strftime(b,
sizeof(b),
"%Y-%m-%d %H:%M:%S", &tm_0);
127 p = ::strftime(b,
sizeof(b),
"%Y-%m-%dT%H:%M:%S", &tm_0);
130 if( 0 < p && p <
sizeof(b) - 1 ) {
132 const size_t remaining =
sizeof(b) - p;
133 if( !muteTime && 0 <
tv_nsec ) {
134 q = ::snprintf(b + p, remaining,
".%09" PRIi64,
tv_nsec);
136 if( !space_separator ) {
137 ::snprintf(b + p + q, remaining-q,
"Z");
140 return std::string(b);
145 unsigned hour,
unsigned minute,
146 unsigned seconds, uint64_t nano_seconds)
noexcept {
148 if( !( 1<=month && month<=12 &&
151 minute<=59 && seconds<=60 ) ) {
155 ::memset(&tm_0, 0,
sizeof(tm_0));
156 tm_0.tm_year = year - 1900;
157 tm_0.tm_mon =
static_cast<int>(month) - 1;
158 tm_0.tm_mday =
static_cast<int>(day);
159 tm_0.tm_hour =
static_cast<int>(hour);
160 tm_0.tm_min =
static_cast<int>(minute);
161 tm_0.tm_sec =
static_cast<int>(seconds);
162 std::time_t t1 = ::timegm (&tm_0);
163 res.
tv_sec =
static_cast<int64_t
>(t1);
164 res.
tv_nsec =
static_cast<int64_t
>(nano_seconds);
169 int64_t utcOffsetSec;
170 size_t consumedChars;
172 if(
value(addUTCOffset) ) {
173 res.
tv_sec += utcOffsetSec;
182 if(
nullptr == datestr.data() || 0 == datestr.length() ) {
185 const char *
const str = datestr.data();
186 const size_t len = datestr.length();
192 const int items = std::sscanf(str,
"%4d-%2u-%2u%n", &y, &M, &d, &count);
194 if( 3 != items || !(5 <= count &&
static_cast<size_t>(count) <= len) ) {
204 if( str[idx] ==
'Z' ) {
208 if( str[idx] ==
'T' ) {
210 }
else if( str[idx] ==
' ' ) {
214 }
while( idx < len && str[idx] ==
' ' );
222 unsigned h=0,m=0,s=0;
225 const int items = std::sscanf(str+idx,
"%2u:%2u:%2u%n", &h, &m, &s, &count);
227 if( 3 != items || !(5 <= count &&
static_cast<size_t>(count) <= len - idx) ) {
238 if( str[idx] ==
'Z' ) {
242 if( str[idx] ==
'.' ) {
250 const int items = std::sscanf(str+idx,
"%9lu%n", &
fs, &count);
252 if( 1 != items || !(0 <= count &&
static_cast<size_t>(count) <= len - idx) ) {
258 if( 9 < fs_digits ) {
261 res.
tv_nsec =
static_cast<int64_t
>(
fs) *
static_cast<int64_t
>( std::pow(10, 9 - fs_digits) );
267 if( str[idx] ==
'Z' ) {
274 while( idx < len && str[idx] ==
' ' ) {
280 int64_t offset_sign = 1;
281 if( str[idx] ==
'+' ) {
283 }
else if( str[idx] ==
'-' ) {
294 const int items = std::sscanf(str+idx,
"%2u%n", &oh, &count);
296 if( 1 != items || !(1 <= count &&
static_cast<size_t>(count) <= len - idx) ) {
303 if( str[idx] ==
':' ) {
308 const int items = std::sscanf(str+idx,
"%2u%n", &om, &count);
317 utcOffsetSec = offset_sign * ( ( oh * 60_i64 * 60_i64 ) + ( om * 60_i64 ) );
322 constexpr uint64_t ms_per_sec = 1'000UL;
323 constexpr uint64_t ns_per_ms = 1'000'000UL;
324 constexpr uint64_t ns_per_sec = 1'000'000'000UL;;
325 const int64_t td_ns_0 =
static_cast<int64_t
>( (td_ms * ns_per_ms) % ns_per_sec );
327 ts.tv_sec =
static_cast<decltype(ts.tv_sec)
>(td_ms/ms_per_sec);
328 ts.tv_nsec = td_ns_0;
331 res = ::clock_nanosleep(CLOCK_MONOTONIC, 0, &ts, &ts);
332 }
while( ignore_irq && EINTR == res );
336 struct timespec ts = relative_time.to_timespec();
339 res = ::clock_nanosleep(CLOCK_MONOTONIC, 0, &ts, &ts);
340 }
while( ignore_irq && EINTR == res );
349 struct timespec ts = absolute_time.to_timespec();
352 res = ::clock_nanosleep(monotonic ? CLOCK_MONOTONIC : CLOCK_REALTIME,
353 TIMER_ABSTIME, &ts, &ts);
354 }
while( ignore_irq && EINTR == res );
363 return sleep_until( now + relative_time, monotonic, ignore_irq );
370 bool overflow =
false;
375 return sleep_until( atime, monotonic, ignore_irq );
379#if defined(__linux__) && defined(__GLIBC__)
388 pthread_mutex_t *__restrict __mutex,
390 const struct timespec *__restrict __abstime)
391 __nonnull ((1, 2, 4)) __attribute__((weak));
393 static
bool __jau__has_pthread_cond_clockwait() noexcept {
395 ::fprintf(stderr,
"INFO: jau::has_pthread_cond_clockwait: %d\n", r);
399 static bool r = __jau__has_pthread_cond_clockwait();
405 pthread_mutex_t * __mutex,
407 const struct timespec * __abstime) {
422 return std::cv_status::no_timeout;
425 struct timespec ts = absolute_time.to_timespec();
429 monotonic ? CLOCK_MONOTONIC : CLOCK_REALTIME, &ts);
431 ::pthread_cond_timedwait(cv.native_handle(), lock.mutex()->native_handle(), &ts);
435 return now < absolute_time ? std::cv_status::no_timeout : std::cv_status::timeout;
438std::cv_status
jau::wait_for(std::condition_variable& cv, std::unique_lock<std::mutex>& lock,
const fraction_timespec& relative_time,
const bool monotonic)
noexcept {
440 return std::cv_status::no_timeout;
443 return wait_until(cv, lock, now + relative_time, monotonic);
446std::cv_status
jau::wait_for(std::condition_variable& cv, std::unique_lock<std::mutex>& lock,
const fraction_i64& relative_time,
const bool monotonic)
noexcept {
448 return std::cv_status::no_timeout;
450 bool overflow =
false;
453 return std::cv_status::timeout;
455 return wait_until(cv, lock, atime, monotonic);
463 std::stringstream ss;
464 ss.setf(std::ios_base::hex | std::ios_base::showbase);
465 ss <<
"Thread " << id;
471: msg_( std::move(
type) ),
474 msg_.append(
" @ ").append(file).append(
":").append(std::to_string(line)).append(
": ").append(m);
476 what_.append(
"\nNative backtrace:\n");
477 what_.append(backtrace_);
481 const nsize_t cstr_max_len = std::min(buffer_len, max_len);
482 const size_t cstr_len = ::strnlen(
reinterpret_cast<const char*
>(buffer), cstr_max_len);
483 return std::string(
reinterpret_cast<const char*
>(buffer), cstr_len);
487 s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](
int ch) {
488 return !std::isspace(ch);
490 s.erase(std::find_if(s.rbegin(), s.rend(), [](
int ch) {
491 return !std::isspace(ch);
501std::vector<std::string>
jau::split_string(
const std::string& str,
const std::string& separator)
noexcept {
502 std::vector<std::string> res;
504 while( p0 != std::string::npos && p0 < str.size() ) {
505 size_t p1 = str.find(separator, p0);
506 res.push_back(str.substr(p0, p1));
507 if( p1 != std::string::npos ) {
508 p1 += separator.length();
516 std::transform(s.begin(), s.end(), s.begin(),
517 [](
unsigned char c){ return std::tolower(c); });
530 if( uuid16_le_octet_index > 14 ) {
531 std::string msg(
"uuid16_le_octet_index ");
532 msg.append(std::to_string(uuid16_le_octet_index));
533 msg.append(
", not within [0..14]");
553 offset = 15 - 1 - uuid16_le_octet_index;
555 offset = uuid16_le_octet_index;
565 if( uuid32_le_octet_index > 12 ) {
566 std::string msg(
"uuid32_le_octet_index ");
567 msg.append(std::to_string(uuid32_le_octet_index));
568 msg.append(
", not within [0..12]");
588 offset = 15 - 3 - uuid32_le_octet_index;
590 offset = uuid32_le_octet_index;
602 const size_t bsz = 1024;
606 nchars = std::vsnprintf(&str[0], bsz, format, ap);
614 const size_t bsz = std::min<size_t>(nchars+1, str.max_size()+1);
617 nchars = std::vsnprintf(&str[0], bsz, format, ap);
625 va_start (args, format);
633 if(
'0' <= c && c <=
'9') {
636 if(
'A' <= c && c <=
'F') {
639 if(
'a' <= c && c <=
'f') {
645size_t jau::hexStringBytes(std::vector<uint8_t>& out,
const std::string& hexstr,
const bool lsbFirst,
const bool checkLeading0x)
noexcept {
649size_t jau::hexStringBytes(std::vector<uint8_t>& out,
const uint8_t hexstr[],
const size_t hexstr_len,
const bool lsbFirst,
const bool checkLeading0x)
noexcept {
651 if( checkLeading0x && hexstr_len >= 2 && hexstr[0] ==
'0' && hexstr[1] ==
'x' ) {
662 const size_t hexlen_in = hexstr_len - offset;
663 const size_t bsize = hexlen_in / 2;
665 out.reserve(bsize + hexlen_in % 2);
671 const bool has_single_nibble = 0 < hexlen_in % 2;
672 uint8_t high_msb_nibble = 0;
673 if( !lsbFirst && has_single_nibble ) {
675 const size_t idx = 0;
676 assert( hexstr_len - 1 >= offset + idx );
679 high_msb_nibble =
static_cast<uint8_t
>( l );
687 for (; i < bsize; ++i) {
688 const size_t idx = ( lsb*i + msb*(bsize-1-i) ) * 2;
689 assert( hexstr_len - 1 >= offset + idx + 1 );
692 if( 0 <= h && 0 <= l ) {
693 out.push_back(
static_cast<uint8_t
>( (h << 4) + l ) );
699 if( has_single_nibble ) {
701 assert( hexstr_len - 1 == offset + i*2 );
704 out.push_back(
static_cast<uint8_t
>( (h << 4) + 0 ) );
710 out.push_back( high_msb_nibble );
713 assert( hexlen_in/2 + hexlen_in%2 == out.size() );
717uint64_t
jau::from_hexstring(std::string
const & s,
const bool lsbFirst,
const bool checkLeading0x)
noexcept
719 std::vector<uint8_t> out;
722 while( out.size() <
sizeof(uint64_t) ) {
726 while( out.size() <
sizeof(uint64_t) ) {
727 out.insert(out.cbegin(), 0);
737 const bool lsbFirst,
const bool lowerCase,
const bool skipLeading0x)
noexcept
742 if(
nullptr == data ) {
748 const uint8_t *
const bytes =
static_cast<const uint8_t*
>(data);
752 str.reserve(length * 2 +1);
753 for (
nsize_t j = 0; j < length; j++) {
754 const int v = bytes[j] & 0xFF;
755 str.push_back(hex_array[v >> 4]);
756 str.push_back(hex_array[v & 0x0F]);
760 if( skipLeading0x ) {
761 str.reserve(length * 2 +1);
763 str.reserve(length * 2 +1 +2);
767 bool skip_leading_zeros =
true;
771 const int v = bytes[j] & 0xFF;
772 if( 0 != v || !skip_leading_zeros || j == 0 ) {
773 str.push_back(hex_array[v >> 4]);
774 str.push_back(hex_array[v & 0x0F]);
775 skip_leading_zeros =
false;
786 if( 2 > dest.capacity() - dest.size() ) {
787 dest.reserve(dest.size()+2);
789 const int v =
value & 0xFF;
790 dest.push_back(hex_array[v >> 4]);
791 dest.push_back(hex_array[v & 0x0F]);
828bool jau::to_integer(
long long & result,
const char * str,
size_t str_len,
const char limiter,
const char *limiter_pos) {
829 static constexpr const bool _debug =
false;
830 char *endptr =
nullptr;
831 if(
nullptr == limiter_pos ) {
832 limiter_pos = str + str_len;
835 const long long num = std::strtoll(str, &endptr, 10);
838 if constexpr ( _debug ) {
839 INFO_PRINT(
"Value under- or overflow occurred, value %lld in: '%s', errno %d %s", num, str, errno, strerror(errno));
843 if(
nullptr == endptr || endptr == str ) {
845 if constexpr ( _debug ) {
846 INFO_PRINT(
"Value no digits consumed @ idx %d, %p == start, in: '%s'", endptr-str, endptr, str);
850 if( endptr < limiter_pos ) {
851 while( endptr < limiter_pos && ::isspace(*endptr) ) {
855 if( *endptr != limiter || endptr != limiter_pos ) {
857 if constexpr ( _debug ) {
858 INFO_PRINT(
"Value end not '%c' @ idx %d, %p != %p, in: %p '%s' len %zd", limiter, endptr-str, endptr, limiter_pos, str, str, str_len);
866bool jau::to_integer(
long long & result,
const std::string& str,
const char limiter,
const char *limiter_pos) {
867 return to_integer(result, str.c_str(), str.size(), limiter, limiter_pos);
871 static constexpr const bool _debug =
false;
872 const char * str =
const_cast<const char*
>(
value.c_str());
873 const size_t str_len =
value.length();
874 const char *divptr =
nullptr;
876 divptr = std::strstr(str,
"/");
877 if(
nullptr == divptr ) {
878 if constexpr ( _debug ) {
885 if( !
to_integer(num, str, str_len,
'/', divptr) ) {
890 if( !
to_integer(denom, divptr+1, str_len-(divptr-str)-1,
'\0', str + str_len) ) {
895 if( ! ( min_allowed <= temp && temp <= max_allowed ) ) {
897 if constexpr ( _debug ) {
898 INFO_PRINT(
"Numerator out of range, not %s <= %s <= %s, in: '%s'", min_allowed.to_string().c_str(), temp.
to_string().c_str(), max_allowed.to_string().c_str(), str);
922 std::string r(
"TypeInfo[addr ");
925 .append(
", `").append(
name())
926 .append(
"`, ident").append(
to_string(m_idflags));
static const char * HEX_ARRAY_BIG
static snsize_t hexCharByte_(const uint8_t c)
static int pthread_cond_clockwait(pthread_cond_t *__cond, pthread_mutex_t *__mutex, os_clockid_t __clock_id, const struct timespec *__abstime)
static bool jau_has_pthread_cond_clockwait() noexcept
static const char * HEX_ARRAY_LOW
ExceptionBase(std::string &&type, std::string const &m, const char *file, int line) noexcept
std::string to_string(const bool show_double=false) const noexcept
Returns a string representation of this fraction.
std::string toString() const noexcept
constexpr size_t hash_code() const noexcept
Returns an unspecified hash code of this instance.
constexpr bool is_little_endian() noexcept
Evaluates true if platform is running in little endian mode, i.e.
constexpr bool is_big_endian() noexcept
Evaluates true if platform is running in big endian mode, i.e.
constexpr bool is_defined_endian(const endian_t &v) noexcept
Evaluates true if the given endian is defined, i.e.
constexpr bool is_little_or_big_endian() noexcept
Evaluates true if platform is running in little or big endian mode, i.e.
endian_t
Endian identifier, indicating endianess of all scalar types.
lb_endian_t
Simplified reduced endian type only covering little- and big-endian.
std::string to_string(const endian_t v) noexcept
Return std::string representation of the given endian.
const uint8_t * cast_char_ptr_to_uint8(const char *s) noexcept
@ pdp
Identifier for DEC PDP-11, aka ENDIAN_LITTLE_WORD.
@ undefined
Undetermined endian.
@ native
Identifier for native platform type, one of the above.
@ little
Identifier for little endian.
@ honeywell
Identifier for Honeywell 316, aka ENDIAN_BIG_WORD.
@ big
Identifier for big endian.
@ little
Identifier for little endian, equivalent to endian::little.
@ big
Identifier for big endian, equivalent to endian::big.
constexpr bool value(const Bool rhs) noexcept
constexpr std::enable_if_t< sizeof(Dest)==sizeof(Source) &&std::is_pointer_v< Source > &&std::is_pointer_v< Dest >, Dest > pointer_cast(const Source &src) noexcept
A constexpr pointer cast implementation for C++17, inspired by C++20 bit_cast<>(arg).
#define __attrdef_no_optimize__
constexpr std::string_view name(const Bool v) noexcept
Bool
Boolean type without implicit conversion, safe for function parameter.
bool to_fraction_i64(fraction_i64 &result, const std::string &value, const fraction_i64 &min_allowed, const fraction_i64 &max_allowed) noexcept
Stores the fraction_i64 value of the given string value in format <num>/<denom>, which may contain wh...
fraction_timespec getWallClockTime() noexcept
Returns current wall-clock real-time since Unix Epoch 00:00:00 UTC on 1970-01-01.
fraction_timespec getMonotonicTime() noexcept
Returns current monotonic time since Unix Epoch 00:00:00 UTC on 1970-01-01.
fraction< int64_t > fraction_i64
fraction using int64_t as integral type
target_type
func::target_type identifier for the target function delegate_t<R, A...> object, exposed by jau::func...
@ null
Denotes a func::null_target_t.
@ lambda
Denotes a func::lambda_target_t.
@ capval
Denotes a func::capval_target_t.
@ capref
Denotes a func::capref_target_t.
@ member
Denotes a func::member_target_t.
@ free
Denotes a func::free_target_t.
@ std
Denotes a func::std_target_t.
@ ylambda
Denotes a func::ylambda_target_t.
constexpr nsize_t digits10(const T x, const snsize_t x_sign, const bool sign_is_digit=true) noexcept
Returns the number of decimal digits of the given integral value number using std::log10<T>().
uint_fast32_t nsize_t
Natural 'size_t' alternative using uint_fast32_t as its natural sized type.
uint128dp_t merge_uint128(uint16_t const uuid16, uint128dp_t const &base_uuid, nsize_t const uuid16_le_octet_index)
Merge the given 'uuid16' into a 'base_uuid' copy at the given little endian 'uuid16_le_octet_index' p...
int_fast32_t snsize_t
Natural 'ssize_t' alternative using int_fast32_t as its natural sized type.
math_error_t
Error types as specified by C++ Math Error Handling
std::string to_string(const math_error_t v) noexcept
Returns std::string representation of math_error_t.
@ underflow
See FE_UNDERFLOW, i.e.
@ overflow
See FE_OVERFLOW, i.e.
@ undefined
undefined math error
@ div_by_zero
See FE_DIVBYZERO, i.e.
@ inexact
See FE_INEXACT, i.e.
@ invalid
See FE_INVALID, i.e.
void zero_bytes_sec(void *s, size_t n) noexcept __attrdecl_no_optimize__
Wrapper to ::explicit_bzero(), ::bzero() or ::memset(), whichever is available in that order.
std::string & toLowerInPlace(std::string &s) noexcept
std::string trim(const std::string &s) noexcept
trim copy
std::string vformat_string(const char *format, va_list ap)
Returns a string according to vprintf() formatting rules using va_list instead of a variable number o...
void trimInPlace(std::string &s) noexcept
trim in place
std::string to_hexstring(value_type const &v, const bool skipLeading0x=false) noexcept
Produce a lower-case hexadecimal string representation with leading 0x in MSB of the given pointer.
std::string get_string(const uint8_t *buffer, nsize_t const buffer_len, nsize_t const max_len) noexcept
Returns a C++ String taken from buffer with maximum length of min(max_len, max_len).
uint64_t from_hexstring(std::string const &s, const bool lsbFirst=!jau::is_little_endian(), const bool checkLeading0x=true) noexcept
Converts a given hexadecimal string representation into a uint64_t value according to hexStringBytes(...
std::string & byteHexString(std::string &dest, const uint8_t value, const bool lowerCase) noexcept
Produce a hexadecimal string representation of the given byte value.
bool to_integer(long long &result, const std::string &str, const char limiter='\0', const char *limiter_pos=nullptr)
std::string bytesHexString(const void *data, const nsize_t length, const bool lsbFirst, const bool lowerCase=true, const bool skipLeading0x=false) noexcept
Produce a hexadecimal string representation of the given byte values.
std::vector< std::string > split_string(const std::string &str, const std::string &separator) noexcept
Split given string str at separator into the resulting std::vector excluding the separator sequence .
std::string format_string(const char *format,...)
Returns a string according to printf() formatting rules and variable number of arguments following th...
std::string toLower(const std::string &s) noexcept
size_t hexStringBytes(std::vector< uint8_t > &out, const std::string &hexstr, const bool lsbFirst, const bool checkLeading0x) noexcept
Converts a given hexadecimal string representation into a byte vector.
Author: Sven Gothel sgothel@jausoft.com Copyright Gothel Software e.K.
constexpr const jau::fraction_timespec zero(0, 0)
jau::fraction_timespec zero is { 0, 0 }
constexpr const jau::fraction_i64 zero(0l, 1lu)
zero is 0/1
Author: Sven Gothel sgothel@jausoft.com Copyright (c) 2022 Gothel Software e.K.
__pack(...): Produces MSVC, clang and gcc compatible lead-in and -out macros.
std::string get_backtrace(const bool skip_anon_frames, const jau::snsize_t max_frames=-1, const jau::snsize_t skip_frames=1) noexcept
Returns a de-mangled backtrace string separated by newline excluding this function.
std::cv_status wait_for(std::condition_variable &cv, std::unique_lock< std::mutex > &lock, const fraction_timespec &relative_time, const bool monotonic=true) noexcept
wait_for causes the current thread to block until the condition variable is notified,...
uint64_t getWallClockSeconds() noexcept
Returns current wall-clock system time of day in seconds since Unix Epoch 00:00:00 UTC on 1 January 1...
std::string threadName(const std::thread::id id) noexcept
void INFO_PRINT(const char *format,...) noexcept
Use for unconditional informal messages, prefix '[elapsed_time] Info: '.
std::cv_status wait_until(std::condition_variable &cv, std::unique_lock< std::mutex > &lock, const fraction_timespec &absolute_time, const bool monotonic=true) noexcept
wait_until causes the current thread to block until the condition variable is notified,...
bool sleep_until(const fraction_timespec &absolute_time, const bool monotonic=true, const bool ignore_irq=true) noexcept
sleep_until causes the current thread to block until the specific time is reached.
bool sleep(const fraction_timespec &relative_time, const bool ignore_irq=true) noexcept
sleep using high precision monotonic timer, useful for one-shot delays (only).
bool milli_sleep(uint64_t td_ms, const bool ignore_irq=true) noexcept
millisecond sleep using high precision monotonic timer, useful for one-shot delays (only).
uint64_t getCurrentMilliseconds() noexcept
Returns current monotonic time in milliseconds.
bool sleep_for(const fraction_timespec &relative_time, const bool monotonic=true, const bool ignore_irq=true) noexcept
sleep_for causes the current thread to block until a specific amount of time has passed.
Timespec structure using int64_t for its components in analogy to struct timespec_t on 64-bit platfor...
int64_t tv_nsec
Nanoseconds component with its absolute value in range [0..1'000'000'000[ or [0..1'000'000'000).
int64_t tv_sec
Seconds component, with its absolute value in range [0..inf[ or [0..inf).
std::string to_string() const noexcept
Return simple string representation in seconds and nanoseconds.
constexpr fraction_timespec() noexcept
Constructs a zero fraction_timespec instance.
std::string to_iso8601_string(bool space_separator=false, bool muteTime=false) const noexcept
Convenience string conversion interpreted since Unix Epoch in UTC to ISO 8601 YYYY-mm-ddTHH:MM:SS....
static fraction_timespec from(const std::string_view datestr, int64_t &utcOffsetSec, size_t &consumedChars) noexcept
Conversion constructor from an ISO8601 time string, as produced via to_iso8601_string().
Support aligned memory transfer from and to potentially unaligned memory.
A 128-bit packed uint8_t data array.