Skip to content

Commit

Permalink
utils: add function now
Browse files Browse the repository at this point in the history
  • Loading branch information
utnapischtim committed Nov 15, 2024
1 parent 91c4be9 commit a3bcefd
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions invenio_db/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@
#
# This file is part of Invenio.
# Copyright (C) 2017-2018 CERN.
# Copyright (C) 2024 Graz University of Technology.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
# from .signals import secret_key_changed

"""Invenio-DB utility functions."""

from datetime import datetime, timezone

from flask import current_app
from sqlalchemy import inspect
from werkzeug.local import LocalProxy
Expand Down Expand Up @@ -129,3 +132,8 @@ def has_table(engine, table):
except AttributeError:
# SQLAlchemy <1.4
return engine.has_table(table)


def now():
"""Creates a datetime object."""
return datetime.now(timezone.utc).replace(tzinfo=None)

0 comments on commit a3bcefd

Please sign in to comment.