mirror of
https://repo.or.cz/socat.git
synced 2025-07-15 07:33:25 +00:00
Corrections for Ubuntu-24 with newer compilers
This commit is contained in:
parent
676888e8cc
commit
63f67101f4
5 changed files with 27 additions and 17 deletions
8
socat.c
8
socat.c
|
@ -1339,7 +1339,6 @@ int _socat(void) {
|
|||
should be at least MAXTIMESTAMPLEN bytes long.
|
||||
returns 0 on success or -1 if an error occurred */
|
||||
int gettimestamp(char *timestamp) {
|
||||
size_t bytes;
|
||||
#if HAVE_CLOCK_GETTIME
|
||||
struct timespec now;
|
||||
#elif HAVE_PROTOTYPE_LIB_gettimeofday
|
||||
|
@ -1367,17 +1366,16 @@ int gettimestamp(char *timestamp) {
|
|||
}
|
||||
#endif
|
||||
#if HAVE_STRFTIME
|
||||
bytes = strftime(timestamp, 20, "%Y/%m/%d %H:%M:%S", localtime(&nowt));
|
||||
strftime(timestamp, 20, "%Y/%m/%d %H:%M:%S", localtime(&nowt));
|
||||
#if HAVE_CLOCK_GETTIME
|
||||
bytes += sprintf(timestamp+19, "."F_tv_nsec" ", now.tv_nsec/1000);
|
||||
sprintf(timestamp+19, "."F_tv_nsec" ", now.tv_nsec/1000);
|
||||
#elif HAVE_PROTOTYPE_LIB_gettimeofday
|
||||
bytes += sprintf(timestamp+19, "."F_tv_usec" ", now.tv_usec);
|
||||
sprintf(timestamp+19, "."F_tv_usec" ", now.tv_usec);
|
||||
#else
|
||||
strncpy(×tamp[bytes++], " ", 2);
|
||||
#endif
|
||||
#else
|
||||
strcpy(timestamp, ctime(&nowt));
|
||||
bytes = strlen(timestamp);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue