forked from lei.chen/myxce
feat(controller-status): render responderTime in cmd_ctrlstatus, log-comparable format (task 6.3)
Add ctrlstatus_fmt.h (ctrlstatus_format_time_ms): renders responder_time_ms as local YYYY-MM-DD HH:MM:SS,mmm, byte-equivalent to the controller log prefix (tlog/my_tlog_format) so a captured ctrlstatus lines up against ctrl-N.log. cmd_ctrlstatus prints a responderTime line; TZ-pinned exact-string unit test. Req 11.2, 11.3. ctrlstatus group passes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
3799bd6af4
commit
ee30765d31
4 changed files with 115 additions and 1 deletions
|
|
@ -18,6 +18,7 @@
|
|||
#include "client.h"
|
||||
#include "config.h" /* XCE_MAXNAME_LEN */
|
||||
#include "controller.capnp.h"
|
||||
#include "ctrlstatus_fmt.h" /* ctrlstatus_format_time_ms (task 6.3) */
|
||||
#include "delay.h"
|
||||
#include "idgen.h"
|
||||
#include "preason.h"
|
||||
|
|
@ -1334,6 +1335,20 @@ int cmd_ctrlstatus(int argc, char* argv[])
|
|||
printf("appliedLsn: %llu\n", (unsigned long long)status->appliedLsn);
|
||||
printf("fenced: %s\n", status->fenced ? "true" : "false");
|
||||
|
||||
/* Responder snapshot timestamp (Req 11.2/11.3): render the responder's
|
||||
* sample-time wall clock (epoch ms) in the SAME local-time
|
||||
* "YYYY-MM-DD HH:MM:SS,mmm" form the controller logger emits, so it can be
|
||||
* compared directly against ctrl-N.log. */
|
||||
{
|
||||
char tbuf[64];
|
||||
if (ctrlstatus_format_time_ms(status->responder_time_ms, tbuf,
|
||||
sizeof(tbuf)) != NULL) {
|
||||
printf("responderTime: %s\n", tbuf);
|
||||
} else {
|
||||
printf("responderTime: unknown\n");
|
||||
}
|
||||
}
|
||||
|
||||
xcecli_free_ctrlstatus(status);
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue