Borneq
2017-01-14 17:11:59 UTC
Mam
struct tm
{
int tm_sec; // seconds after the minute - [0, 60] including leap
second
int tm_min; // minutes after the hour - [0, 59]
int tm_hour; // hours since midnight - [0, 23]
int tm_mday; // day of the month - [1, 31]
int tm_mon; // months since January - [0, 11]
int tm_year; // years since 1900
int tm_wday; // days since Sunday - [0, 6]
int tm_yday; // days since January 1 - [0, 365]
int tm_isdst; // daylight savings time flag
};
time_t t = time(0); // get time now
struct tm* now = localtime(&t);
fp << now->tm_year + 1900 << "-" << now->tm_mon + 1 << "-" <<
now->tm_mday << " "
<< now->tm_hour << ":" << now->tm_min << ":" << now->tm_sec << " ";
fp << str;
Do logu wypisuję czas, chciałbym mieć dokładność lepsza niż sekunda
zarówno pod Windows jak i Linuxa
struct tm
{
int tm_sec; // seconds after the minute - [0, 60] including leap
second
int tm_min; // minutes after the hour - [0, 59]
int tm_hour; // hours since midnight - [0, 23]
int tm_mday; // day of the month - [1, 31]
int tm_mon; // months since January - [0, 11]
int tm_year; // years since 1900
int tm_wday; // days since Sunday - [0, 6]
int tm_yday; // days since January 1 - [0, 365]
int tm_isdst; // daylight savings time flag
};
time_t t = time(0); // get time now
struct tm* now = localtime(&t);
fp << now->tm_year + 1900 << "-" << now->tm_mon + 1 << "-" <<
now->tm_mday << " "
<< now->tm_hour << ":" << now->tm_min << ":" << now->tm_sec << " ";
fp << str;
Do logu wypisuję czas, chciałbym mieć dokładność lepsza niż sekunda
zarówno pod Windows jak i Linuxa