A portable representation of a file's (local) time. More...
#include <file.h>
Public Member Functions | |
bool | construct_from_string (std::string s) |
Construct the time from a unix, ls -l, style string. Note that there is a more flexibile string to date conversion function,. | |
FileTime (std::string s) | |
FileTime (struct tm const *) | |
FileTime() construct from a struct tm*. | |
FileTime () | |
FileTime() default constructor. | |
operator std::string () const | |
std::string | short_string () const |
Convert time to a string in the form expected by construct_from_string() above. | |
Public Attributes | |
int | day |
day of the month, starting with 1 | |
int | hour |
hour, 0 - 23 | |
int | minute |
minute, 0 - 59 | |
int | month |
month, 0 is january | |
int | second |
second, 0 - 59 | |
int | year |
year minus 1900 | |
Friends | |
bool | operator< (FileTime const &l, FileTime const &r) |
std::ostream & | operator<< (std::ostream &o, FileTime const &r) |
convert the time to a string (long format ) |
A portable representation of a file's (local) time.
A FileTime object hold's a time information appropos to a file. It has member functions typically used in printing and displaying the time associated with files.
Definition at line 54 of file file.h.
FileTime | ( | ) |
FileTime() default constructor.
FileTime | ( | struct tm const * | p | ) |
FileTime() construct from a struct tm*.
FileTime | ( | std::string | s | ) |
bool construct_from_string | ( | std::string | s | ) |
Construct the time from a unix, ls -l, style string. Note that there is a more flexibile string to date conversion function,.
The construct_from_string method recognizes input of the form:
Mon day year_or_hour
For example:
Dec 12 2003 Feb 9 10:45
The difference between the two examples is that instead of supplying a year as part of the date, the second example supplies the hour of the day. This implies that the year is the _current_ year. When the hour is missing, then the hour is assumed to be 12:00 am.
The return value of true means that the string is of an invalid format
Definition at line 204 of file file.cxx.
operator std::string | ( | ) | const |
string short_string | ( | ) | const |
Convert time to a string in the form expected by construct_from_string() above.
std::ostream& operator<< | ( | std::ostream & | o, | |
FileTime const & | r | |||
) | [friend] |