nk 1.0.0
C++ Numerical Computing Runtime
Loading...
Searching...
No Matches
timefun.hpp File Reference

Date, time, high-resolution profiling timers, and calendar utilities. More...

#include <memory_resource>
#include <string>
#include <nk/value/value.hpp>
#include <nk/value/span.hpp>

Go to the source code of this file.

Functions

double nk::builtin::cputime ()
 Total CPU time consumed by the current process in seconds (cputime).
void nk::builtin::pause (double seconds)
 Halts execution for specified number of seconds (pause(n)).
double nk::builtin::now ()
 Current date and time as a serial date number (now).
std::string nk::builtin::date ()
 Current date as formatted text 'dd-mmm-yyyy' (date).
Value nk::builtin::clock (std::pmr::memory_resource *mr=nullptr)
 Current date and time as a 6-element vector [Y, M, D, H, MI, S] (clock).
Value nk::builtin::etime (const Value &t2, const Value &t1, std::pmr::memory_resource *mr=nullptr)
 Elapsed time in seconds between two date vectors (etime(t2, t1)).
Value nk::builtin::datenum (Span< const Value > args, std::pmr::memory_resource *mr=nullptr)
 Converts date components or string to serial date number (datenum(...)).
Value nk::builtin::datestr (Span< const Value > args, std::pmr::memory_resource *mr=nullptr)
 Formats serial date number or date vector into text string (datestr(...)).
Value nk::builtin::datevec (Span< const Value > args, std::pmr::memory_resource *mr=nullptr)
 Converts serial date number or text into date vector matrix [Y, M, D, H, MI, S] (datevec(...)).
Value nk::builtin::weekday (const Value &d, std::pmr::memory_resource *mr=nullptr)
 Day of week for date number or text (weekday(d)).
Value nk::builtin::eomday (const Value &y, const Value &m, std::pmr::memory_resource *mr=nullptr)
 End of month day for year and month (eomday(y, m)).
Value nk::builtin::calendar (Span< const Value > args, std::pmr::memory_resource *mr=nullptr)
 Generates 6x7 calendar matrix for year and month (calendar(...)).
Value nk::builtin::juliandate (Span< const Value > args, std::pmr::memory_resource *mr=nullptr)
 Julian date number from serial date or date components (juliandate(...)).
Value nk::builtin::mjuliandate (Span< const Value > args, std::pmr::memory_resource *mr=nullptr)
 Modified Julian date number (mjuliandate(...)).
Value nk::builtin::weeknum (Span< const Value > args, std::pmr::memory_resource *mr=nullptr)
 Week number of the year for a given date (weeknum(...)).
Value nk::builtin::addtodate (const Value &d, double quantity, const std::string &unit, std::pmr::memory_resource *mr=nullptr)
 Shifts date by quantity in specified time units (addtodate(d, q, unit)).
Value nk::builtin::yyyymmdd (Span< const Value > args, std::pmr::memory_resource *mr=nullptr)
 Formats date number as ISO integer YYYYMMDD (yyyymmdd(...)).

Detailed Description

Date, time, high-resolution profiling timers, and calendar utilities.

Provides a clean, engine-free C++ API for serial date numbers, calendar operations, date formatting, date vector conversions, and timing utilities.

Definition in file timefun.hpp.