Fosi Fossil Service
Small teams. Open source. Built on Fossil.

IaC / SwiftFlow

High-performance WMS with wave picking, smart routing, and real-time inventory visibility.

Public | Owner: IaC | Default branch: trunk | Last update: 2026-10-23 14:37

Artifact 8a1e8b8c0b6e2e57dbff93262b154e00e2a18366bc1c4b969c1c218fadbd9daf:


-module(swiftflow_clock_ffi).
-export([now_local/0, today_local/0, shift_days_local/1, shift_seconds_local/1, monotonic_ms/0]).

now_local() ->
    datetime(calendar:local_time()).

shift_seconds_local(Seconds) when is_integer(Seconds) ->
    Now = calendar:datetime_to_gregorian_seconds(calendar:local_time()),
    datetime(calendar:gregorian_seconds_to_datetime(Now + Seconds)).

datetime({{Y, M, D}, {H, Min, S}}) ->
    iolist_to_binary([date(Y, M, D), " ", two(H), ":", two(Min), ":", two(S)]).

today_local() ->
    {{Y, M, D}, _} = calendar:local_time(),
    date(Y, M, D).

monotonic_ms() ->
    erlang:monotonic_time(millisecond).

shift_days_local(Days) when is_integer(Days) ->
    {{Y, M, D}, _} = calendar:local_time(),
    Greg = calendar:date_to_gregorian_days({Y, M, D}) + Days,
    {Y2, M2, D2} = calendar:gregorian_days_to_date(Greg),
    date(Y2, M2, D2).

date(Y, M, D) ->
    iolist_to_binary([integer_to_binary(Y), "-", two(M), "-", two(D)]).

two(N) when N < 10 ->
    <<"0", (integer_to_binary(N))/binary>>;
two(N) ->
    integer_to_binary(N).

Clone

You can clone this repository with the following command:

fossil clone https://fosi.dev/IaC/SwiftFlow

Contribute

The best way to contribute is through e-mail. See the project documentation for more details.