std::experi...le_time_type(3)
π std::experi...le_time_type(3) π
Okay bestie, this oneβs from the C++ Standard Libary β yep, βLibary,β thatβs literally how the header spells it, Iβm not fixing it π β and itβs the manual page for std::experi...le_time_type(3). Itβs giving βfilesystem timestamps are my main character eraβ energy π°οΈβ¨
πΈ NAME πΈ
std::experimental::filesystem::file_time_type β std::experimental::filesystem::file_time_type
π¦ Synopsis π¦
Defined in header <experimental/filesystem>
using file_time_type = chrono::time_point</*trivial-clock*/>;
(filesystem TS)
It represents file time. trivial-clock is an implementation-defined type that satisfies TrivialClock and is sufficient to represent the resolution and range of the file time values offered by the filesystem π
π Example π
// Run this code
#include <chrono>
#include <experimental/filesystem>
#include <fstream>
#include <iomanip>
#include <iostream>
namespace fs = std::experimental::filesystem;
using namespace std::chrono_literals;
int main()
{
fs::path p = fs::current_path() / "example.bin";
std::ofstream(p.c_str()).put('a'); // create file
auto ftime = fs::last_write_time(p);
std::time_t cftime = decltype(ftime)::clock::to_time_t(ftime); //
assuming system_clock
std::cout << "File write time is " <<
std::asctime(std::localtime(&cftime)) << '\n';
fs::last_write_time(p, ftime + 1h); // move file write time 1 hour
to the future
ftime = fs::last_write_time(p); // read back from the filesystem
cftime = decltype(ftime)::clock::to_time_t(ftime);
std::cout << "File write time is " <<
std::asctime(std::localtime(&cftime)) << '\n';
fs::remove(p);
}
π Possible output π
File write time is Tue Mar 31 19:47:04 2015
File write time is Tue Mar 31 20:47:04 2015
π₯ See also π₯
last_write_timeβ gets or sets the time of the last data modification (function) β°
π Category π
- Noindexed pages
π Thatβs the whole page, bestie! Source is http://cppreference.com, version/date is 2024.06.10, and the footer title is std::experi...le_time_type(3). Go slay those file timestamps, periodt π
β¨
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms