FileTime Struct Reference

A portable representation of a file's (local) time. More...

#include <file.h>

List of all members.

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 )

Detailed Description

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.


Constructor & Destructor Documentation

FileTime (  ) 

FileTime() default constructor.

Definition at line 127 of file file.h.

FileTime ( struct tm const *  p  ) 

FileTime() construct from a struct tm*.

Definition at line 280 of file file.cxx.

FileTime ( std::string  s  ) 
Parameters:
s ls -l time format (mon day year/hour)

Definition at line 139 of file file.h.

Here is the call graph for this function:


Member Function Documentation

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,.

See also:
parse_date. That function is meant for user interfaces. This function is meant for parsing ls -l style output only.

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.

Here is the caller graph for this function:

operator std::string (  )  const
string short_string (  )  const

Convert time to a string in the form expected by construct_from_string() above.

Definition at line 154 of file file.cxx.


Friends And Related Function Documentation

bool operator< ( FileTime const &  l,
FileTime const &  r 
) [friend]

Definition at line 70 of file file.h.

std::ostream& operator<< ( std::ostream &  o,
FileTime const &  r 
) [friend]

convert the time to a string (long format )

prints the time to an output stream (long format)

Definition at line 121 of file file.h.


Member Data Documentation

int day

day of the month, starting with 1

Definition at line 65 of file file.h.

int hour

hour, 0 - 23

Definition at line 66 of file file.h.

int minute

minute, 0 - 59

Definition at line 67 of file file.h.

int month

month, 0 is january

Definition at line 64 of file file.h.

int second

second, 0 - 59

Definition at line 68 of file file.h.

int year

year minus 1900

Definition at line 63 of file file.h.


The documentation for this struct was generated from the following files:
Generated on Wed Feb 29 22:55:29 2012 for CXXUtilities by  doxygen 1.6.3