diff options
| author | login (tilde.institute) <login@tilde.institute> | 2020-09-22 01:58:09 -0400 |
|---|---|---|
| committer | login (tilde.institute) <login@tilde.institute> | 2020-09-22 01:58:09 -0400 |
| commit | b379602cd8122e19fde7aeca5ef09560cb6cff86 (patch) | |
| tree | 701595a75bd14b0ed94aae4f252310117aa66083 | |
| parent | f377b6f162f701de8163d575b67b81452c54e761 (diff) | |
| download | tcoin-b379602cd8122e19fde7aeca5ef09560cb6cff86.tar.gz | |
Fixed bug in date generation for messages on OpenBSD systems
On OpenBSD, the equivalent of %_d is %e. This is fixed for OpenBSD/tilde.institute type systems now.
| -rw-r--r-- | pcoin.cpp | 12 | ||||
| -rw-r--r-- | tcoin.cpp | 12 |
2 files changed, 20 insertions, 4 deletions
@@ -690,7 +690,11 @@ int send_message(const char* sender_username, const char* receiver_username, con time_t now = std::time(NULL); char dt[26]; - std::strftime(dt, 26, "%a %b %_d %T %Y", std::gmtime(&now)); + #ifndef TILDEINSTITUTE + std::strftime(dt, 26, "%a %b %_d %T %Y", std::gmtime(&now)); + #else + std::strftime(dt, 26, "%a %b %e %T %Y", std::gmtime(&now)); + #endif char sender_formatted_string[26]; char sender_arrow_formatted_string[47]; char sender_arrow_string[47]; @@ -877,7 +881,11 @@ int send_message(const char* sender_username, const char* receiver_username, con fout << fin.rdbuf(); now = std::time(NULL); - std::strftime(dt, 26, "%a %b %_d %T %Y", std::gmtime(&now)); + #ifndef TILDEINSTITUTE + std::strftime(dt, 26, "%a %b %_d %T %Y", std::gmtime(&now)); + #else + std::strftime(dt, 26, "%a %b %e %T %Y", std::gmtime(&now)); + #endif char sender_formatted_string_right_aligned[26]; char receiver_arrow_formatted_string[47]; char receiver_arrow_string[47]; @@ -970,7 +970,11 @@ int send_message(const char* sender_username, const char* receiver_username, con time_t now = std::time(NULL); char dt[26]; - std::strftime(dt, 26, "%a %b %_d %T %Y", std::gmtime(&now)); + #ifndef TILDEINSTITUTE + std::strftime(dt, 26, "%a %b %_d %T %Y", std::gmtime(&now)); + #else + std::strftime(dt, 26, "%a %b %e %T %Y", std::gmtime(&now)); + #endif char sender_formatted_string[26]; char sender_arrow_formatted_string[47]; char sender_arrow_string[47]; @@ -1157,7 +1161,11 @@ int send_message(const char* sender_username, const char* receiver_username, con fout << fin.rdbuf(); now = std::time(NULL); - std::strftime(dt, 26, "%a %b %_d %T %Y", std::gmtime(&now)); + #ifndef TILDEINSTITUTE + std::strftime(dt, 26, "%a %b %_d %T %Y", std::gmtime(&now)); + #else + std::strftime(dt, 26, "%a %b %e %T %Y", std::gmtime(&now)); + #endif char sender_formatted_string_right_aligned[26]; char receiver_arrow_formatted_string[47]; char receiver_arrow_string[47]; |