Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:25
erlang
1546-snmp-Types-and-specs-for-snmp-validate_dat...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 1546-snmp-Types-and-specs-for-snmp-validate_date_and_time.patch of Package erlang
From 00139bd719d70d95474c29a620aef1dba659a9cd Mon Sep 17 00:00:00 2001 From: Micael Karlberg <bmk@erlang.org> Date: Thu, 11 Jan 2024 09:40:33 +0100 Subject: [PATCH 26/67] [snmp] Types and specs for snmp:validate_date_and_time/0,1 --- lib/snmp/doc/src/snmp.xml | 32 ++++++-------------------------- lib/snmp/src/app/snmp.erl | 7 +++++++ 2 files changed, 13 insertions(+), 26 deletions(-) diff --git a/lib/snmp/doc/src/snmp.xml b/lib/snmp/doc/src/snmp.xml index ca9a8f6f19..a8619a6b4c 100644 --- a/lib/snmp/doc/src/snmp.xml +++ b/lib/snmp/doc/src/snmp.xml @@ -358,38 +358,18 @@ </func> <func> - <name since="">validate_date_and_time(DateAndTime) -> bool()</name> - <name since="">validate_date_and_time(DateAndTime, Validate) -> bool()</name> + <name name="validate_date_and_time" arity="1" clause_i="1" since=""/> + <name name="validate_date_and_time" arity="2" clause_i="1" since=""/> <fsummary>Check if a DateAndTime value is correct</fsummary> - <type> - <v>DateAndTime = term()</v> - <v>Validate = fun(Kind, Data) -> boolean()</v> - </type> <desc> <p>Checks if <c>DateAndTime</c> is a correct DateAndTime - value, as specified in RFC2579. This function can be used in - instrumentation functions to validate a DateAndTime value.</p> + value, as specified in RFC2579. This function can be used in + instrumentation functions to validate a DateAndTime value.</p> - - <p>The validation fun, <c>Validate</c>, allows for a more "flexible" + <p>The validation fun, <c>Validate</c>, allows for a more "flexible" validation of the <c>DateAndTime</c> argument. Whenever the data is found to not follow RFC2579, the fun is called to allow a more - "lax" validation. - The input to the validation fun looks like this: </p> - - <pre> - Kind Data - -------------- ---------------------- - year {Year1, Year2} - month Month - day Day - hour Hour - minute Minute - seconds Seconds - deci_seconds DeciSeconds - diff [Sign, Hour, Minute] - valid_date {Year, Month, Day} - </pre> + "lax" validation. </p> <marker id="passwd2localized_key"></marker> </desc> diff --git a/lib/snmp/src/app/snmp.erl b/lib/snmp/src/app/snmp.erl index 46a4f18adf..3bafb8ac8e 100644 --- a/lib/snmp/src/app/snmp.erl +++ b/lib/snmp/src/app/snmp.erl @@ -906,10 +906,17 @@ date_and_time_to_universal_time_dst([Y1, Y2, Mo, D, H, M, S, _Ds, Sign, Hd, Md]) [calendar:gregorian_seconds_to_datetime(UTCSecs)]. +-spec validate_date_and_time(DateAndTime) -> boolean() when + DateAndTime :: rfc1903_date_and_time(). + validate_date_and_time(DateAndTime) -> Validate = fun(What, Data) -> strict_validation(What, Data) end, validate_date_and_time(DateAndTime, Validate). +-spec validate_date_and_time(DateAndTime, Validate) -> boolean() when + DateAndTime :: rfc1903_date_and_time(), + Validate :: date_and_time_validator(). + validate_date_and_time(DateAndTime, Validate) when is_function(Validate) -> do_validate_date_and_time(DateAndTime, Validate). -- 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