upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.cpp')
-rw-r--r--src/util.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/util.cpp b/src/util.cpp
index 68bd18e..e4e314f 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -490,3 +490,15 @@ void AddTimeData(unsigned int ip, int64 nTime)
490 printf("| nTimeOffset = %+lld (%+lld minutes)\n", nTimeOffset, nTimeOffset/60); 490 printf("| nTimeOffset = %+lld (%+lld minutes)\n", nTimeOffset, nTimeOffset/60);
491 } 491 }
492} 492}
493
494// Formats a block or transaction timestamp for logs and for the wallet view.
495// It lived in gui.cpp, but main.cpp logs block times with it, so a headless
496// build needed it too -- and nothing about formatting a date is GUI work.
497string DateTimeStr(int64 nTime)
498{
499 time_t t = (time_t)nTime;
500 struct tm* p = localtime(&t);
501 if (!p) return "";
502 char buf[32]; strftime(buf, sizeof(buf), "%m/%d/%y %H:%M", p);
503 return buf;
504}