2
0
mirror of git://git.code.sf.net/p/openocd/code synced 2025-07-18 23:42:45 +10:00
openocd/src/helper/util.c
Antonio Borneo 842a12f4ca helper: util: rewrite command 'ms' as COMMAND_HANDLER
Use full 64 bits in output; no reason to truncate at 32 bits.

Change-Id: I433815a381e147731ff0da2c805170649a9bcf38
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7487
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
2023-03-25 18:10:14 +00:00

42 lines
1012 B
C

// SPDX-License-Identifier: GPL-2.0-or-later
/***************************************************************************
* Copyright (C) 2010 by Øyvind Harboe *
***************************************************************************/
/* this file contains various functionality useful to standalone systems */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "log.h"
#include "time_support.h"
COMMAND_HANDLER(handler_util_ms)
{
if (CMD_ARGC != 0)
return ERROR_COMMAND_SYNTAX_ERROR;
command_print(CMD, "%" PRId64, timeval_ms());
return ERROR_OK;
}
static const struct command_registration util_command_handlers[] = {
{
.name = "ms",
.mode = COMMAND_ANY,
.handler = handler_util_ms,
.help =
"Returns ever increasing milliseconds. Used to calculate differences in time.",
.usage = "",
},
COMMAND_REGISTRATION_DONE
};
int util_init(struct command_context *cmd_ctx)
{
return register_commands(cmd_ctx, NULL, util_command_handlers);
}