Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:25
erlang
1526-snmp-Types-and-specs-for-snmp-date_and_tim...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 1526-snmp-Types-and-specs-for-snmp-date_and_time_to_strin.patch of Package erlang
From 2592812f9f0cc1f3cca4bd55a50e3fcb4ef9b8ff Mon Sep 17 00:00:00 2001 From: Micael Karlberg <bmk@erlang.org> Date: Tue, 9 Jan 2024 19:41:56 +0100 Subject: [PATCH 06/67] [snmp] Types and specs for snmp:date_and_time_to_string2/1 Also fixed the type of the log-size argument to the change_log_size/2 function. --- lib/snmp/doc/src/snmp.xml | 26 +++++++++++++++++--------- lib/snmp/src/app/snmp.erl | 27 ++++++++++++++++++++------- 2 files changed, 37 insertions(+), 16 deletions(-) diff --git a/lib/snmp/doc/src/snmp.xml b/lib/snmp/doc/src/snmp.xml index 8b616bf3c1..e91e0eb83b 100644 --- a/lib/snmp/doc/src/snmp.xml +++ b/lib/snmp/doc/src/snmp.xml @@ -111,6 +111,16 @@ </desc> </datatype> + <datatype> + <name name="log_size"/> + <desc> + <p> + This is basically a copy of the + <seetype marker="disk_log#dlog_size">dlog_size()</seetype>. + </p> + </desc> + </datatype> + <!-- <datatype> <name name="void"/> @@ -249,8 +259,8 @@ <marker id="dat2s"></marker> <marker id="date_and_time_to_string"></marker> - <marker id="date_and_time_to_string1"></marker> - <marker id="date_and_time_to_string2"></marker> + <marker id="date_and_time_to_string_1"></marker> + <marker id="date_and_time_to_string_2"></marker> </desc> </func> @@ -270,20 +280,18 @@ function for more info on the <c>Validate</c> fun. </p> <marker id="dat2s2"></marker> + <marker id="date_and_time_to_string2"></marker> </desc> </func> <func> - <name since="">date_and_time_to_string2(DateAndTime) -> string()</name> + <name name="date_and_time_to_string2" arity="1" clause_i="1" since=""/> <fsummary>Convert a DateAndTime value to a string</fsummary> - <type> - <v>DateAndTime = [int()]</v> - </type> <desc> <p>Converts a DateAndTime list to a printable string, according - to the DISPLAY-HINT definition in RFC2579, with the extension - that it also allows the values "hours from UTC" = 14 together with - "minutes from UTC" = 0. </p> + to the DISPLAY-HINT definition in RFC2579, with the extension + that it also allows the values "hours from UTC" = 14 together with + "minutes from UTC" = 0. </p> <marker id="lt2dat_dst"></marker> </desc> diff --git a/lib/snmp/src/app/snmp.erl b/lib/snmp/src/app/snmp.erl index 19c69b53ac..4bb3a03364 100644 --- a/lib/snmp/src/app/snmp.erl +++ b/lib/snmp/src/app/snmp.erl @@ -122,6 +122,15 @@ %% Types %%----------------------------------------------------------------- +%% This type, which is documented in disk_log, +%% is not actually exported by disk_log. +%% Instead is defined in an internal header file. +%% So we have to create a "copy" of it here. +%% Lets hope it never changes... +-type log_size() :: 'infinity' | pos_integer() | + {MaxNoBytes :: pos_integer(), + MaxNoFiles :: pos_integer()}. + -type bits() :: integer(). -type octet() :: 0..255. -type octet_string() :: [octet()]. @@ -721,11 +730,6 @@ check_kiribati_diff(_) -> false. -date_and_time_to_string2(DAT) -> - Validate = fun(What, Data) -> kiribati_validation(What, Data) end, - date_and_time_to_string(DAT, Validate). - - -spec date_and_time_to_string(DAT) -> string() when DAT :: rfc1903_date_and_time(). @@ -733,7 +737,6 @@ date_and_time_to_string(DAT) -> Validate = fun(What, Data) -> strict_validation(What, Data) end, date_and_time_to_string(DAT, Validate). - -spec date_and_time_to_string(DAT, Validate) -> string() when DAT :: rfc1903_date_and_time(), Validate :: date_and_time_validator(). @@ -746,6 +749,16 @@ date_and_time_to_string(DAT, Validate) when is_function(Validate) -> exit({badarg, {?MODULE, date_and_time_to_string, [DAT]}}) end. + +-spec date_and_time_to_string2(DAT) -> string() when + DAT :: rfc1903_date_and_time(). + +date_and_time_to_string2(DAT) -> + Validate = fun(What, Data) -> kiribati_validation(What, Data) end, + date_and_time_to_string(DAT, Validate). + + + dat2str([Y1,Y2, Mo, D, H, M, S, Ds | Diff]) -> lists:flatten(io_lib:format("~w-~w-~w,~w:~w:~w.~w", [y(Y1,Y2),Mo,D,H,M,S,Ds]) ++ @@ -981,7 +994,7 @@ log_to_io(LogDir, Mibs, LogName, LogFile, Block, Start, Stop) -> -spec change_log_size(LogName, NewSize) -> ok | {error, Reason} when LogName :: string(), - NewSize :: disk_log:dlog_size(), + NewSize :: log_size(), Reason :: term(). change_log_size(LogName, NewSize) -> -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor