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 | |
| 9 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 10 | --- |
| 11 | util/dvbdate/dvbdate.c | 5 ++++- |
| 12 | 1 file changed, 4 insertions(+), 1 deletion(-) |
| 13 | |
Brad Bishop | e42b3e3 | 2020-01-15 22:08:42 -0500 | [diff] [blame] | 14 | --- a/util/dvbdate/dvbdate.c |
| 15 | +++ b/util/dvbdate/dvbdate.c |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 16 | @@ -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] | 17 | */ |
| 18 | int set_time(time_t * new_time) |
| 19 | { |
| 20 | - if (stime(new_time)) { |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 21 | + struct timespec s = {0}; |
| 22 | + s.tv_sec = *new_time; |
| 23 | + |
| 24 | + if (clock_settime(CLOCK_REALTIME, &s)) { |
Brad Bishop | e42b3e3 | 2020-01-15 22:08:42 -0500 | [diff] [blame] | 25 | perror("Unable to set time"); |
| 26 | return -1; |
| 27 | } |