{% macro m_current_timestamp(type) %}

{% if type | lower == 'db' %}

    {% if execute %}

        {% set get_timestamp %}
            SELECT to_char(current_timestamp, 'YYYY-MM-DD HH24:MI:SS') FROM DUAL
        {% endset %}

        {% set result = run_query(get_timestamp) %}
        {% set current_timestamp = result.columns[0].values()[0] %}

    {% endif %}

{% else %}
    {% set current_timestamp = modules.datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") %}
{% endif %}

{{ return(current_timestamp) }}

{% endmacro %}