aboutsummaryrefslogtreecommitdiff
path: root/src/time.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/time.c')
-rw-r--r--src/time.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/src/time.c b/src/time.c
index 01919de..9a5068b 100644
--- a/src/time.c
+++ b/src/time.c
@@ -14,36 +14,31 @@
You should have received a copy of the GNU General Public License
along with vmod-tbf. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <config.h>
-#include <stdlib.h>
-#include <stdio.h>
+#include "tbf.h"
#include <time.h>
-#include "vrt.h"
-#include "vcc_if.h"
-#include "bin/varnishd/cache.h"
-int
-vmod_systime(struct sess *sp)
+VCL_INT
+vmod_systime(MOD_CTX ctx)
{
return time(NULL);
}
-const char *
-vmod_strftime(struct sess *sp, const char *format, int timestamp)
+VCL_STRING
+vmod_strftime(MOD_CTX ctx, VCL_STRING format, VCL_INT timestamp)
{
time_t ts = (time_t) timestamp;
size_t u, n;
char *p;
- u = WS_Reserve(sp->wrk->ws, 0);
- p = sp->wrk->ws->f;
+ u = WS_Reserve(WSPTR(ctx), 0);
+ p = WSPTR(ctx)->f;
n = strftime(p, u, format, gmtime(&ts));
if (n == 0) {
- WS_Release(sp->wrk->ws, 0);
+ WS_Release(WSPTR(ctx), 0);
return NULL;
}
- WS_Release(sp->wrk->ws, n + 1);
+ WS_Release(WSPTR(ctx), n + 1);
return p;
}

Return to:

Send suggestions and report system problems to the System administrator.