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 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
헤더 파일에 정의됨
<experimental/filesystem>
|
||
|
using
file_time_type
=
chrono
::
time_point
<
/*trivial-clock*/
>
;
|
(filesystem TS) | |
파일 시간을 나타냅니다.
trivial-clock
는
TrivialClock
요구 사항을 충족하는 구현 정의 타입이며, 파일 시스템이 제공하는 파일 시간 값의 해상도와 범위를 표현하기에 충분합니다.
예제
이 코드 실행
#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'); // 파일 생성 auto ftime = fs::last_write_time(p); std::time_t cftime = decltype(ftime)::clock::to_time_t(ftime); // system_clock 가정 std::cout << "File write time is " << std::asctime(std::localtime(&cftime)) << '\n'; fs::last_write_time(p, ftime + 1h); // 파일 수정 시간을 1시간 미래로 이동 ftime = fs::last_write_time(p); // 파일시스템에서 다시 읽기 cftime = decltype(ftime)::clock::to_time_t(ftime); std::cout << "File write time is " << std::asctime(std::localtime(&cftime)) << '\n'; fs::remove(p); }
가능한 출력:
File write time is Tue Mar 31 19:47:04 2015 File write time is Tue Mar 31 20:47:04 2015
참고 항목
|
마지막 데이터 수정 시간을 가져오거나 설정합니다
(function) |