Brad Bishop | e42b3e3 | 2020-01-15 22:08:42 -0500 | [diff] [blame] | 1 | From d6817dbaf407f65dd4af12c51736153fae8b217f Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Sat, 21 Dec 2019 08:36:11 -0800 |
| 4 | Subject: [PATCH] dvbdate: Remove Obsoleted stime API calls |
| 5 | |
| 6 | stime() has been deprecated in glibc 2.31+ its recommended to |
| 7 | replaced with clock_settime() |
| 8 | |
Patrick Williams | 8e7b46e | 2023-05-01 14:19:06 -0500 | [diff] [blame] | 9 | Upstream-Status: Pending |
Brad Bishop | e42b3e3 | 2020-01-15 22:08:42 -0500 | [diff] [blame] | 10 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 11 | --- |
| 12 | util/dvbdate/dvbdate.c | 5 ++++- |
| 13 | 1 file changed, 4 insertions(+), 1 deletion(-) |
| 14 | |
Brad Bishop | e42b3e3 | 2020-01-15 22:08:42 -0500 | [diff] [blame] | 15 | --- a/util/dvbdate/dvbdate.c |
| 16 | +++ b/util/dvbdate/dvbdate.c |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 17 | @@ -309,7 +309,10 @@ int atsc_scan_date(time_t *rx_time, unsi |
Brad Bishop | e42b3e3 | 2020-01-15 22:08:42 -0500 | [diff] [blame] | 18 | */ |
| 19 | int set_time(time_t * new_time) |
| 20 | { |
| 21 | - if (stime(new_time)) { |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 22 | + struct timespec s = {0}; |
| 23 | + s.tv_sec = *new_time; |
| 24 | + |
| 25 | + if (clock_settime(CLOCK_REALTIME, &s)) { |
Brad Bishop | e42b3e3 | 2020-01-15 22:08:42 -0500 | [diff] [blame] | 26 | perror("Unable to set time"); |
| 27 | return -1; |
| 28 | } |