A GPS disciplined clock
Dependencies: net lpc1768 crypto clock web log
Diff: http-derived/home/http-home-query.c
- Revision:
- 43:bf39371b4576
- Parent:
- 29:4fe0f237fd61
--- a/http-derived/home/http-home-query.c Mon Mar 11 16:47:04 2019 +0000 +++ b/http-derived/home/http-home-query.c Thu Mar 14 16:57:28 2019 +0000 @@ -1,7 +1,3 @@ -#include <string.h> -#include <stdlib.h> -#include <stdio.h> - #include "http.h" #include "clkgov.h" #include "clkutc.h" @@ -15,6 +11,7 @@ char* pName; char* pValue; pQuery = HttpQuerySplit(pQuery, &pName, &pValue); + int value = HttpQueryValueAsInt(pValue); if (HttpSameStr(pName, "chg-clock-leap-enable" )) ClkUtcTglNextLeapEnable (); if (HttpSameStr(pName, "chg-clock-leap-forward")) ClkUtcTglNextLeapForward(); @@ -25,23 +22,22 @@ if (HttpSameStr(pName, "set-clock-leap-year" )) { - years = strtol(pValue, NULL, 10) - 1970; + years = value - 1970; if (years < 0) years = 0; ClkUtcSetNextEpochMonth1970(years * 12 + months); } if (HttpSameStr(pName, "set-clock-leap-month" )) { - months = strtol(pValue, NULL, 10) - 1; + months = value - 1; if (months < 0) months = 0; ClkUtcSetNextEpochMonth1970(years * 12 + months); } if (HttpSameStr(pName, "set-clock-leap-count" )) { - uint16_t leaps = strtol(pValue, NULL, 10); + uint16_t leaps = value; ClkUtcSetEpochOffset(leaps); } - int value = (int)strtol(pValue, NULL, 10); if (HttpSameStr(pName, "ppb" )) ClkGovSetPpb (value ); if (HttpSameStr(pName, "slewdivisor" )) SetClockSlewDivisor (value ); if (HttpSameStr(pName, "slewmax" )) SetClockSlewMaxMs (value );