Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/chrono/file clock/to from sys"

From cppreference.com
< cpp‎ | chrono‎ | file clock
m (link to ja)
m (=)
 
(4 intermediate revisions by 4 users not shown)
Line 2: Line 2:
 
{{cpp/chrono/file_clock/navbar}}
 
{{cpp/chrono/file_clock/navbar}}
 
{{dcl begin}}
 
{{dcl begin}}
{{dcl|num=1|since=c++20|notes={{mark optional}} |1=
+
{{dcl|num=1|since=c++20|notes={{mark tooltip|optional|provided only if to_utc and from_utc are not provided}}|
template <class Duration>
+
template< class Duration >
 
static std::chrono::sys_time</*see below*/>
 
static std::chrono::sys_time</*see below*/>
     to_sys(const std::chrono::file_time<Duration>& t);
+
     to_sys( const std::chrono::file_time<Duration>& t );
 
}}
 
}}
{{dcl|num=2|since=c++20|notes={{mark optional}} |1=
+
{{dcl|num=2|since=c++20|notes={{mark tooltip|optional|provided only if to_utc and from_utc are not provided}}|
template <class Duration>
+
template< class Duration >
 
static std::chrono::file_time</*see below*/>
 
static std::chrono::file_time</*see below*/>
     from_sys(const std::chrono::sys_time<Duration>& t);
+
     from_sys( const std::chrono::sys_time<Duration>& t );
 
}}
 
}}
 
{{dcl end}}
 
{{dcl end}}
  
@1@ Converts the {{tt|file_time}} {{tt|t}} to a {{tt|sys_time}} representing the same point in time.
+
@1@ Converts the {{tt|file_time}} {{c|t}} to a {{tt|sys_time}} representing the same point in time.
@2@ Converts the {{tt|sys_time}} {{tt|t}} to a {{tt|file_time}} representing the same point in time.
+
@2@ Converts the {{tt|sys_time}} {{c|t}} to a {{tt|file_time}} representing the same point in time.
  
 
The duration of the return type is computed from {{tt|Duration}} in an unspecified manner.
 
The duration of the return type is computed from {{tt|Duration}} in an unspecified manner.
  
These function templates are optional: an implementation may choose to instead provide {{tt|to_utc}} and {{tt|from_utc}}.
+
These function templates are optional: an implementation may choose to instead provide {{rlpf|to from utc|to_utc}} and {{rlpf|to from utc|from_utc}}.
  
=== Return value ===
+
===Return value===
 
@1@ A {{tt|sys_time}} representing the same point in time as the argument.
 
@1@ A {{tt|sys_time}} representing the same point in time as the argument.
 
@2@ A {{tt|file_time}} representing the same point in time as the argument.
 
@2@ A {{tt|file_time}} representing the same point in time as the argument.
  
=== Notes ===
+
===Notes===
User code should usually use {{lc|std::chrono::clock_cast}}, which provides a generic interface to convert time points between clocks, rather than call these functions directly.
+
User code should usually use {{c/core|std::chrono::clock_cast}}, which provides a generic interface to convert time points between clocks, rather than call these functions directly.
  
=== See also ===
+
===Example===
 +
{{example}}
 +
 
 +
===See also===
 
{{dsc begin}}
 
{{dsc begin}}
{{dsc inc |cpp/chrono/file clock/dsc to from utc}}
+
{{dsc inc|cpp/chrono/file clock/dsc to from utc}}
{{dsc inc |cpp/chrono/dsc clock_cast}}
+
{{dsc inc|cpp/chrono/dsc clock_cast}}
 
{{dsc end}}
 
{{dsc end}}
  
{{langlinks|ja|zh}}
+
{{langlinks|es|ja|ru|zh}}

Latest revision as of 17:22, 1 November 2024

 
 
Utilities library
General utilities
Relational operators (deprecated in C++20)
 
 
std::chrono::file_clock
Member functions

file_clock::to_sysfile_clock::from_sys
(optional*)

Time point I/O
 
template< class Duration >

static std::chrono::sys_time</*see below*/>

    to_sys( const std::chrono::file_time<Duration>& t );
(1) (since C++20)
(optional*)
template< class Duration >

static std::chrono::file_time</*see below*/>

    from_sys( const std::chrono::sys_time<Duration>& t );
(2) (since C++20)
(optional*)
1) Converts the file_time t to a sys_time representing the same point in time.
2) Converts the sys_time t to a file_time representing the same point in time.

The duration of the return type is computed from Duration in an unspecified manner.

These function templates are optional: an implementation may choose to instead provide to_utc() and from_utc().

Contents

[edit] Return value

1) A sys_time representing the same point in time as the argument.
2) A file_time representing the same point in time as the argument.

[edit] Notes

User code should usually use std::chrono::clock_cast, which provides a generic interface to convert time points between clocks, rather than call these functions directly.

[edit] Example

[edit] See also

[static] (optional)
converts between file_time and utc_time
(public static member function) [edit]
convert time points of one clock to another
(function template) [edit]