From 80099b60e1fc436569f33cb38ab6608ef163478c Mon Sep 17 00:00:00 2001 From: Kaarle Ritvanen Date: Thu, 12 Feb 2015 16:39:38 +0200 Subject: model: allow arbitrary encoding for back-end data --- aconf/model/time.lua | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'aconf/model/time.lua') diff --git a/aconf/model/time.lua b/aconf/model/time.lua index 099a819..5879bc3 100644 --- a/aconf/model/time.lua +++ b/aconf/model/time.lua @@ -1,5 +1,5 @@ --[[ -Copyright (c) 2012-2014 Kaarle Ritvanen +Copyright (c) 2012-2015 Kaarle Ritvanen See LICENSE file for license details --]] @@ -30,14 +30,12 @@ function M.Timestamp:_offset(value) return time and os.time(time) end -function M.Timestamp:_load(context) - local value = super(self, M.Timestamp):_load(context) +function M.Timestamp:decode(context, value) return value and self.epoch_offset and os.date(self.format, value) or value end -function M.Timestamp:_save(context, value) - if self.epoch_offset then value = self:_offset(value) end - super(self, M.Timestamp):_save(context, value) +function M.Timestamp:encode(context, value) + return self.epoch_offset and self:_offset(value) or value end function M.Timestamp:normalize(context, value) -- cgit v1.2.3