time/now.fz
# This file is part of the Fuzion language implementation.
#
# The Fuzion language implementation is free software: you can redistribute it
# and/or modify it under the terms of the GNU General Public License as published
# by the Free Software Foundation, version 3 of the License.
#
# The Fuzion language implementation is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
# License for more details.
#
# You should have received a copy of the GNU General Public License along with The
# Fuzion language implementation. If not, see <https://www.gnu.org/licenses/>.
# -----------------------------------------------------------------------
#
# Tokiwa Software GmbH, Germany
#
# Source code of Fuzion standard library feature time.now
#
# Author: Michael Lill (michael.lill@tokiwa.software)
#
# -----------------------------------------------------------------------
# effect for getting the current date_time
public now (p () -> time.date_time) : simple_effect is
# get current date_time
#
public get =>
res := p()
replace
res
# default handler for now effect.
# returns the current date_time
# the system is giving us.
#
private type.default_now ()->time.date_time => () ->
arr := fuzion.sys.internal_array_init i32 6
fuzion.std.date_time arr.data
a := arr.as_array
time.date_time a[0] a[1] a[2] a[3] a[4] a[5]
type.install_default =>
(time.now default_now).default
# get the current date_time.
# Uses currently installed time.now effect
# or installs the default_now handler
#
public now =>
now.install_default
now.env
last changed: 2024-03-07