mirror of
https://github.com/curl/curl.git
synced 2026-07-26 09:47:18 +03:00
tool/tests: fix potential year 2038 issues
The length of 'long' in a 32-bit system is 32 bits, which cannot be used to save timestamps after 2038. Most operating systems have extended time_t to 64 bits. Remove the castings to long. Closes #7466
This commit is contained in:
parent
94bd01310b
commit
5b9fedb461
3 changed files with 6 additions and 6 deletions
|
|
@ -86,7 +86,7 @@ struct timeval tvnow(void)
|
|||
(void)gettimeofday(&now, NULL);
|
||||
#else
|
||||
else {
|
||||
now.tv_sec = (long)time(NULL);
|
||||
now.tv_sec = time(NULL);
|
||||
now.tv_usec = 0;
|
||||
}
|
||||
#endif
|
||||
|
|
@ -115,7 +115,7 @@ struct timeval tvnow(void)
|
|||
** time() returns the value of time in seconds since the Epoch.
|
||||
*/
|
||||
struct timeval now;
|
||||
now.tv_sec = (long)time(NULL);
|
||||
now.tv_sec = time(NULL);
|
||||
now.tv_usec = 0;
|
||||
return now;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ struct timeval tutil_tvnow(void)
|
|||
(void)gettimeofday(&now, NULL);
|
||||
#else
|
||||
else {
|
||||
now.tv_sec = (long)time(NULL);
|
||||
now.tv_sec = time(NULL);
|
||||
now.tv_usec = 0;
|
||||
}
|
||||
#endif
|
||||
|
|
@ -96,7 +96,7 @@ struct timeval tutil_tvnow(void)
|
|||
** time() returns the value of time in seconds since the Epoch.
|
||||
*/
|
||||
struct timeval now;
|
||||
now.tv_sec = (long)time(NULL);
|
||||
now.tv_sec = time(NULL);
|
||||
now.tv_usec = 0;
|
||||
return now;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -496,7 +496,7 @@ static struct timeval tvnow(void)
|
|||
(void)gettimeofday(&now, NULL);
|
||||
#else
|
||||
else {
|
||||
now.tv_sec = (long)time(NULL);
|
||||
now.tv_sec = time(NULL);
|
||||
now.tv_usec = 0;
|
||||
}
|
||||
#endif
|
||||
|
|
@ -525,7 +525,7 @@ static struct timeval tvnow(void)
|
|||
** time() returns the value of time in seconds since the Epoch.
|
||||
*/
|
||||
struct timeval now;
|
||||
now.tv_sec = (long)time(NULL);
|
||||
now.tv_sec = time(NULL);
|
||||
now.tv_usec = 0;
|
||||
return now;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue