add function get_time_item_from_str
parent
decd1498d0
commit
e16e0f5d4f
3
HISTORY
3
HISTORY
|
|
@ -1,6 +1,7 @@
|
||||||
|
|
||||||
Version 1.31 2016-11-10
|
Version 1.31 2016-11-11
|
||||||
* move SET_SOCKOPT_NOSIGPIPE from sockopt.c to sockopt.h
|
* move SET_SOCKOPT_NOSIGPIPE from sockopt.c to sockopt.h
|
||||||
|
* add function get_time_item_from_str
|
||||||
|
|
||||||
Version 1.30 2016-10-31
|
Version 1.30 2016-10-31
|
||||||
* modify php-fastcommon/test.php
|
* modify php-fastcommon/test.php
|
||||||
|
|
|
||||||
|
|
@ -1964,16 +1964,25 @@ int get_time_item_from_conf(IniContext *pIniContext, \
|
||||||
const byte default_hour, const byte default_minute)
|
const byte default_hour, const byte default_minute)
|
||||||
{
|
{
|
||||||
char *pValue;
|
char *pValue;
|
||||||
|
pValue = iniGetStrValue(NULL, item_name, pIniContext);
|
||||||
|
return get_time_item_from_str(pValue, item_name, pTimeInfo,
|
||||||
|
default_hour, default_minute);
|
||||||
|
}
|
||||||
|
|
||||||
|
int get_time_item_from_str(const char *pValue, const char *item_name,
|
||||||
|
TimeInfo *pTimeInfo, const byte default_hour,
|
||||||
|
const byte default_minute)
|
||||||
|
{
|
||||||
int hour;
|
int hour;
|
||||||
int minute;
|
int minute;
|
||||||
int second;
|
int second;
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
pValue = iniGetStrValue(NULL, item_name, pIniContext);
|
|
||||||
if (pValue == NULL)
|
if (pValue == NULL)
|
||||||
{
|
{
|
||||||
pTimeInfo->hour = default_hour;
|
pTimeInfo->hour = default_hour;
|
||||||
pTimeInfo->minute = default_minute;
|
pTimeInfo->minute = default_minute;
|
||||||
|
pTimeInfo->second = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -370,7 +370,7 @@ int load_allow_hosts(IniContext *pIniContext, \
|
||||||
/** get time item from config context
|
/** get time item from config context
|
||||||
* parameters:
|
* parameters:
|
||||||
* pIniContext: the config context
|
* pIniContext: the config context
|
||||||
* item_name: item name in config file, time format: hour:minute, such as 15:25
|
* item_name: item name in config file, time format as hour:minute, such as 15:25
|
||||||
* pTimeInfo: store time info
|
* pTimeInfo: store time info
|
||||||
* default_hour: default hour value
|
* default_hour: default hour value
|
||||||
* default_minute: default minute value
|
* default_minute: default minute value
|
||||||
|
|
@ -380,6 +380,20 @@ int get_time_item_from_conf(IniContext *pIniContext, \
|
||||||
const char *item_name, TimeInfo *pTimeInfo, \
|
const char *item_name, TimeInfo *pTimeInfo, \
|
||||||
const byte default_hour, const byte default_minute);
|
const byte default_hour, const byte default_minute);
|
||||||
|
|
||||||
|
|
||||||
|
/** get time item from string
|
||||||
|
* parameters:
|
||||||
|
* pValue: the time string, format as hour:minute, such as 15:25
|
||||||
|
* item_name: item name in config file
|
||||||
|
* pTimeInfo: store time info
|
||||||
|
* default_hour: default hour value
|
||||||
|
* default_minute: default minute value
|
||||||
|
* return: error no , 0 success, != 0 fail
|
||||||
|
*/
|
||||||
|
int get_time_item_from_str(const char *pValue, const char *item_name,
|
||||||
|
TimeInfo *pTimeInfo, const byte default_hour,
|
||||||
|
const byte default_minute);
|
||||||
|
|
||||||
/** trim path tail char /
|
/** trim path tail char /
|
||||||
* parameters:
|
* parameters:
|
||||||
* filePath: the file path to chop
|
* filePath: the file path to chop
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue