Skip to content

Commit 209d157

Browse files
committed
Use time() return value instead of time_t struct
1 parent 8084ddb commit 209d157

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/phongo_ini.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616

1717
#include <stdio.h>
18+
#include <time.h>
1819

1920
#include <php.h>
2021
#include <main/php_open_temporary_file.h>
@@ -27,16 +28,13 @@ ZEND_EXTERN_MODULE_GLOBALS(mongodb)
2728

2829
static FILE* phongo_ini_tmp_file(const char* tmp_dir)
2930
{
30-
time_t t;
3131
int fd = -1;
3232
char* prefix;
3333
int len;
3434
zend_string* filename = NULL;
3535
FILE* stream = NULL;
3636

37-
/* TODO: consider using time() retval directly instead of time_t struct */
38-
time(&t);
39-
len = spprintf(&prefix, 0, "PHONGO-%ld", t);
37+
len = spprintf(&prefix, 0, "PHONGO-%ld", time(NULL));
4038

4139
/* TODO: Refactor this to use fdopen (see: PHPC-2181) */
4240
fd = php_open_temporary_fd(tmp_dir, prefix, &filename);

0 commit comments

Comments
 (0)