![]() | Fun 0.41.5 The programming language that makes You have fun |
Implements OP_DATE_FORMAT to format an epoch milliseconds timestamp using strftime. More...
#include <stdlib.h>#include <string.h>#include <time.h>
Go to the source code of this file.
Functions | |
| if (ms.type !=VAL_INT||fmt.type !=VAL_STRING) | |
| if (!ptm) | |
| if (n==0) | |
| free (buf) | |
| free_value (ms) | |
| free_value (fmt) | |
| push_value (vm, out) | |
Variables | |
| case | OP_DATE_FORMAT |
| Value | ms = pop_value(vm) |
| time_t | secs = (time_t)(ms.i / 1000) |
| struct tm | tmv = *ptm |
| struct tm * | ptm = localtime(&secs) |
| size_t | cap = 128 |
| char * | buf = (char *)malloc(cap) |
| size_t | n = strftime(buf, cap, fmt.s, &tmv) |
| Value | out |
| else | |
| break | |
Implements OP_DATE_FORMAT to format an epoch milliseconds timestamp using strftime.
Behavior:
Errors:
Definition in file date_format.c.
| free | ( | buf | ) |
| free_value | ( | fmt | ) |
| free_value | ( | ms | ) |

| if | ( | ! | ptm | ) |
| if | ( | ms.type ! | = VAL_INT || fmt.type != VAL_STRING | ) |
| if | ( | n | = = 0 | ) |
Definition at line 54 of file date_format.c.
| push_value | ( | vm | , |
| out | ) |

| break |
Definition at line 70 of file date_format.c.
| char* buf = (char *)malloc(cap) |
Definition at line 52 of file date_format.c.
| size_t cap = 128 |
Definition at line 51 of file date_format.c.
| else |
Definition at line 63 of file date_format.c.
| Value ms = pop_value(vm) |
Definition at line 28 of file date_format.c.
| case OP_DATE_FORMAT |
Definition at line 26 of file date_format.c.
| Value out |
Definition at line 60 of file date_format.c.
| struct tm* ptm = localtime(&secs) |
Definition at line 41 of file date_format.c.
| time_t secs = (time_t)(ms.i / 1000) |
Definition at line 36 of file date_format.c.
| tmv = *ptm |
Definition at line 37 of file date_format.c.