FreeBASIC
0.91.0
Main Page
Data Structures
Files
File List
Globals
time_now.c
Go to the documentation of this file.
1
/* NOW function */
2
3
#include "
fb.h
"
4
#include <time.h>
5
6
/*:::::*/
7
FBCALL
double
fb_Now
(
void
)
8
{
9
double
dblTime, dblDate;
10
time_t rawtime;
11
struct
tm *ptm;
12
13
/* guard by global lock because time/localtime might not be thread-safe */
14
FB_LOCK
();
15
16
time( &rawtime );
17
18
/* Note: localtime() can return NULL due to weird value from time() */
19
ptm = localtime( &rawtime );
20
if
(ptm ==
NULL
)
21
return
0.0;
22
23
dblDate =
fb_DateSerial
( 1900 + ptm->tm_year, 1 + ptm->tm_mon, ptm->tm_mday );
24
dblTime =
fb_TimeSerial
( ptm->tm_hour, ptm->tm_min, ptm->tm_sec );
25
26
FB_UNLOCK
();
27
28
return
dblDate + dblTime;
29
}
rtlib
time_now.c
Generated on Thu Jan 23 2014 19:40:14 for FreeBASIC by
1.8.4