]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | /* |
2 | * Dummy Date provider | |
3 | * | |
4 | * There are two minimally required macros which you must provide in | |
5 | * duk_config.h: | |
6 | * | |
7 | * extern duk_double_t dummy_get_now(void); | |
8 | * | |
9 | * #define DUK_USE_DATE_GET_NOW(ctx) dummy_get_now() | |
10 | * #define DUK_USE_DATE_GET_LOCAL_TZOFFSET(d) 0 | |
11 | * | |
12 | * Note that since the providers are macros, you don't need to use | |
13 | * all arguments. Similarly, you can "return" fixed values as | |
14 | * constants. Above, local timezone offset is always zero i.e. | |
15 | * we're always in UTC. | |
16 | * | |
17 | * You can also provide optional macros to parse and format timestamps | |
18 | * in a platform specific format. If not provided, Duktape will use | |
19 | * ISO 8601 only (which is often good enough). | |
20 | */ | |
21 | ||
22 | #include "duktape.h" | |
23 | ||
24 | duk_double_t dummy_get_now(void) { | |
25 | /* Return a fixed time here as a dummy example. */ | |
26 | return -11504520000.0; | |
27 | } |