std::experimental::filesystem:: file_time_type
From cppreference.net
<
cpp
|
experimental
|
fs
C++
Experimental
| Technical Specification | ||||
| Filesystem library (filesystem TS) | ||||
| Library fundamentals (library fundamentals TS) | ||||
| Library fundamentals 2 (library fundamentals TS v2) | ||||
| Library fundamentals 3 (library fundamentals TS v3) | ||||
| Extensions for parallelism (parallelism TS) | ||||
| Extensions for parallelism 2 (parallelism TS v2) | ||||
| Extensions for concurrency (concurrency TS) | ||||
| Extensions for concurrency 2 (concurrency TS v2) | ||||
| Concepts (concepts TS) | ||||
| Ranges (ranges TS) | ||||
| Reflection (reflection TS) | ||||
| Mathematical special functions (special functions TR) | ||||
| Experimental Non-TS | ||||
| Pattern Matching | ||||
| Linear Algebra | ||||
| std::execution | ||||
| Contracts | ||||
| 2D Graphics |
Filesystem library
| Classes | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Functions | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| File types | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Definido en el encabezado
<experimental/filesystem>
|
||
|
using
file_time_type
=
chrono
::
time_point
<
/*trivial-clock*/
>
;
|
(filesystem TS) | |
Representa el tiempo de archivo.
trivial-clock
es un tipo definido por la implementación que satisface
TrivialClock
y es suficiente para representar la resolución y rango de los valores de tiempo de archivo ofrecidos por el sistema de archivos.
Ejemplo
Ejecutar este código
#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'); // crear archivo auto ftime = fs::last_write_time(p); std::time_t cftime = decltype(ftime)::clock::to_time_t(ftime); // asumiendo system_clock std::cout << "File write time is " << std::asctime(std::localtime(&cftime)) << '\n'; fs::last_write_time(p, ftime + 1h); // mover la hora de escritura del archivo 1 hora hacia el futuro ftime = fs::last_write_time(p); // leer nuevamente del sistema de archivos cftime = decltype(ftime)::clock::to_time_t(ftime); std::cout << "File write time is " << std::asctime(std::localtime(&cftime)) << '\n'; fs::remove(p); }
Salida posible:
File write time is Tue Mar 31 19:47:04 2015 File write time is Tue Mar 31 20:47:04 2015
Véase también
|
obtiene o establece la hora de la última modificación de datos
(función) |