Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F92120012
dateandtime.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Nov 17, 13:07
Size
851 B
Mime Type
text/x-c
Expires
Tue, Nov 19, 13:07 (2 d)
Engine
blob
Format
Raw Data
Handle
22378676
Attached To
rSPECMICP SpecMiCP / ReactMiCP
dateandtime.cpp
View Options
#include "dateandtime.hpp"
#include <string>
namespace specmicp {
namespace dateandtime {
std::string to_text(std::time_t& time_point)
{
struct std::tm* timeinfo;
char buffer[80];
timeinfo = std::localtime(&time_point);
std::strftime(buffer, 80, "%F - %T", timeinfo);
return std::string(buffer);
}
std::string to_text_localized(std::time_t& time_point)
{
struct std::tm* timeinfo;
char buffer[80];
timeinfo = std::localtime(&time_point);
std::strftime(buffer, 80, "%x - %X", timeinfo);
return std::string(buffer);
}
std::string now_localized()
{
std::time_t rawtime;
std::time(&rawtime);
return to_text_localized(rawtime);
}
std::string now()
{
std::time_t rawtime;
std::time(&rawtime);
return to_text(rawtime);
}
} //end namespace dateandtime
} //end namespace specmicp
Event Timeline
Log In to Comment