Current section
Files
Jump to
Current section
Files
src/tempo@offset.erl
-module(tempo@offset).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-export([local/0, new/1, to_string/1, from_string/1, literal/1, from_duration/1, to_duration/1, describe_parse_error/1]).
-file("/home/john/Repos/tempo/src/tempo/offset.gleam", 32).
-spec local() -> tempo:offset().
local() ->
_pipe = tempo_ffi:local_offset(),
tempo:offset(_pipe).
-file("/home/john/Repos/tempo/src/tempo/offset.gleam", 37).
-spec new(gleam@time@duration:duration()) -> {ok, tempo:offset()} | {error, nil}.
new(Duration) ->
tempo:new_offset(Duration).
-file("/home/john/Repos/tempo/src/tempo/offset.gleam", 78).
-spec to_string(tempo:offset()) -> binary().
to_string(Offset) ->
tempo:offset_to_string(Offset).
-file("/home/john/Repos/tempo/src/tempo/offset.gleam", 92).
-spec from_string(binary()) -> {ok, tempo:offset()} |
{error, tempo@error:offset_parse_error()}.
from_string(Offset) ->
tempo:offset_from_string(Offset).
-file("/home/john/Repos/tempo/src/tempo/offset.gleam", 55).
-spec literal(binary()) -> tempo:offset().
literal(Offset) ->
case from_string(Offset) of
{ok, Offset@1} ->
Offset@1;
{error, {offset_invalid_format, _}} ->
erlang:error(#{gleam_error => panic,
message => <<"Invalid offset literal format"/utf8>>,
module => <<"tempo/offset"/utf8>>,
function => <<"literal"/utf8>>,
line => 59});
{error, {offset_out_of_bounds, _}} ->
erlang:error(#{gleam_error => panic,
message => <<"Invalid offset literal value"/utf8>>,
module => <<"tempo/offset"/utf8>>,
function => <<"literal"/utf8>>,
line => 61})
end.
-file("/home/john/Repos/tempo/src/tempo/offset.gleam", 113).
-spec from_duration(gleam@time@duration:duration()) -> {ok, tempo:offset()} |
{error, nil}.
from_duration(Duration) ->
tempo:new_offset(Duration).
-file("/home/john/Repos/tempo/src/tempo/offset.gleam", 126).
-spec to_duration(tempo:offset()) -> gleam@time@duration:duration().
to_duration(Offset) ->
tempo:offset_to_duration(Offset).
-file("/home/john/Repos/tempo/src/tempo/offset.gleam", 139).
-spec describe_parse_error(tempo@error:offset_parse_error()) -> binary().
describe_parse_error(Error) ->
tempo@error:describe_offset_parse_error(Error).