File: 06-glibc-stime.patch

package info (click to toggle)
log4cpp 1.1.3-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 4,220 kB
  • sloc: sh: 10,465; cpp: 6,696; ansic: 1,049; makefile: 288
file content (15 lines) | stat: -rw-r--r-- 503 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
The obsolete function stime is no longer available to newly linked binaries
since glibc 2.31. Replace it by clock_settime.

--- a/tests/testDailyRollingFileAppender.cpp
+++ b/tests/testDailyRollingFileAppender.cpp
@@ -232,7 +232,8 @@ namespace OnlyManualTesting {
 
 		now += seconds;
 
-		if (stime(&now) == -1) {
+		struct timespec ts = { .tv_sec = now };
+		if (clock_settime(CLOCK_REALTIME, &ts) == -1) {
 			std::cerr << "Can not set date. Need admin privileges?" << std::endl;
 			return -1;
 		}