aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlogin (tilde.institute) <login@tilde.institute>2020-09-22 01:58:09 -0400
committerlogin (tilde.institute) <login@tilde.institute>2020-09-22 01:58:09 -0400
commitb379602cd8122e19fde7aeca5ef09560cb6cff86 (patch)
tree701595a75bd14b0ed94aae4f252310117aa66083
parentf377b6f162f701de8163d575b67b81452c54e761 (diff)
downloadtcoin-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.cpp12
-rw-r--r--tcoin.cpp12
2 files changed, 20 insertions, 4 deletions
diff --git a/pcoin.cpp b/pcoin.cpp
index 526c70e..1728e33 100644
--- a/pcoin.cpp
+++ b/pcoin.cpp
@@ -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];
diff --git a/tcoin.cpp b/tcoin.cpp
index 77e8466..9370bd0 100644
--- a/tcoin.cpp
+++ b/tcoin.cpp
@@ -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];