public function timestamp($state = 'modification', $user_id = null)
    {
        if ( ! in_array($state, ['creation', 'modification'])) {
            $this->set_error('Unsupported timestamp state '.$state, true);
        }

        $is_datetime = strtolower($this->timestamp_format) == 'datetime';
        $timestamp = $is_datetime ? date('Y-m-d H:i:s') : time();

        if (null === $user_id and !is_cli()) {
            $user_id = $this->session->user_data('user_id') ?: null;
        }

        $stamps = [$this->modification_key => $timestamp];

        if ($state == 'creation') {
            $stamps += [$this->creation_key => $timestamp];
        }

        if ($this->is_autotimestamp) {
            return $stamps;
        }

        return [];
    }