This is an automated email from Gerrit.

"Antonio Borneo <[email protected]>" just uploaded a new patch set to 
Gerrit, which you can find at https://review.openocd.org/c/openocd/+/9745

-- gerrit

commit 0ca21208f0ca01ce898c209ad2c21f56cb3c6a2b
Author: Antonio Borneo <[email protected]>
Date:   Mon Jun 15 23:43:48 2026 +0200

    pld: use duration helper
    
    Replace the custom code that computes the duration of the loading
    time with the OpenOCD helpers.
    
    While there, drop else after the return statement.
    
    Change-Id: Ic574c9fda0cebe076f2c53d49535f9d7fa6a85c6
    Signed-off-by: Antonio Borneo <[email protected]>

diff --git a/src/pld/pld.c b/src/pld/pld.c
index edd7796139..8334ff5fba 100644
--- a/src/pld/pld.c
+++ b/src/pld/pld.c
@@ -249,11 +249,8 @@ COMMAND_HANDLER(handle_pld_devices_command)
 COMMAND_HANDLER(handle_pld_load_command)
 {
        int retval;
-       struct timeval start, end, duration;
        struct pld_device *p;
 
-       gettimeofday(&start, NULL);
-
        if (CMD_ARGC < 2)
                return ERROR_COMMAND_SYNTAX_ERROR;
 
@@ -279,20 +276,21 @@ COMMAND_HANDLER(handle_pld_load_command)
                return ERROR_PLD_FILE_LOAD_FAILED;
        }
 
+       struct duration load_time;
+       duration_start(&load_time);
+
        retval = p->driver->load(p, CMD_ARGV[1]);
        if (retval != ERROR_OK) {
                command_print(CMD, "failed loading file %s to pld device %s",
                        CMD_ARGV[1], CMD_ARGV[0]);
                return retval;
-       } else {
-               gettimeofday(&end, NULL);
-               timeval_subtract(&duration, &end, &start);
-
-               command_print(CMD, "loaded file %s to pld device %s in %jis 
%jius",
-                       CMD_ARGV[1], CMD_ARGV[0],
-                       (intmax_t)duration.tv_sec, (intmax_t)duration.tv_usec);
        }
 
+       duration_measure(&load_time);
+
+       command_print(CMD, "loaded file %s to pld device %s in %f s",
+               CMD_ARGV[1], CMD_ARGV[0], duration_elapsed(&load_time));
+
        return ERROR_OK;
 }
 

-- 

Reply via email to