- what is the time_t/timeval/timespec type used for in this driver the timeval in dummy_g_get_frame is used for getting frame number in every ms.
- is this broken in 2038 or not No. The millisecond of the last second will be normal if tv_sec is overflowed. But for consistency purpose, and avoiding further risks, I have replaced timeval with timespec64. - does the driver use monotonic or real time Real time. But only microsecond part is used. - if it uses real time, should it use monotonic time instead Monotonic time will be ok if it can meet the precise requirement(us). Signed-off-by: WEN Pingbo <[email protected]> Cc: Y2038 <[email protected]> --- drivers/usb/gadget/udc/dummy_hcd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/usb/gadget/udc/dummy_hcd.c b/drivers/usb/gadget/udc/dummy_hcd.c index 1379ad4..7be721dad 100644 --- a/drivers/usb/gadget/udc/dummy_hcd.c +++ b/drivers/usb/gadget/udc/dummy_hcd.c @@ -833,10 +833,10 @@ static const struct usb_ep_ops dummy_ep_ops = { /* there are both host and device side versions of this call ... */ static int dummy_g_get_frame(struct usb_gadget *_gadget) { - struct timeval tv; + struct timespec64 tv; - do_gettimeofday(&tv); - return tv.tv_usec / 1000; + getnstimeofday64(&tv); + return tv.tv_nsec / 1000000L; } static int dummy_wakeup(struct usb_gadget *_gadget) -- 1.9.1 _______________________________________________ Y2038 mailing list [email protected] https://lists.linaro.org/mailman/listinfo/y2038
