fix from_time_t function
This commit is contained in:
parent
cf5e9aa2bb
commit
6b4050ab9c
@ -69,7 +69,7 @@ RC_DEPTREE *_rc_deptree_load (int, int *);
|
|||||||
bool _rc_can_find_pids(void);
|
bool _rc_can_find_pids(void);
|
||||||
|
|
||||||
RC_SERVICE lookup_service_state(const char *service);
|
RC_SERVICE lookup_service_state(const char *service);
|
||||||
char *from_time_t(time_t tv);
|
void from_time_t(char *time_string, time_t tv);
|
||||||
time_t to_time_t(char *timestring);
|
time_t to_time_t(char *timestring);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -443,12 +443,9 @@ RC_SERVICE lookup_service_state(const char *service)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *from_time_t(time_t tv)
|
void from_time_t(char *time_string, time_t tv)
|
||||||
{
|
{
|
||||||
char time_string[20];
|
|
||||||
|
|
||||||
strftime(time_string, 20, "%Y-%m-%d %H:%M:%S", localtime(&tv));
|
strftime(time_string, 20, "%Y-%m-%d %H:%M:%S", localtime(&tv));
|
||||||
return time_string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
time_t to_time_t(char *timestring)
|
time_t to_time_t(char *timestring)
|
||||||
|
@ -186,6 +186,7 @@ static void child_process(char *exec, char **argv, char *svcname,
|
|||||||
char cmdline[PATH_MAX];
|
char cmdline[PATH_MAX];
|
||||||
time_t start_time;
|
time_t start_time;
|
||||||
char start_count_string[20];
|
char start_count_string[20];
|
||||||
|
char start_time_string[20];
|
||||||
|
|
||||||
#ifdef HAVE_PAM
|
#ifdef HAVE_PAM
|
||||||
pam_handle_t *pamh = NULL;
|
pam_handle_t *pamh = NULL;
|
||||||
@ -343,7 +344,8 @@ static void child_process(char *exec, char **argv, char *svcname,
|
|||||||
syslog(LOG_INFO, "Running command line: %s", cmdline);
|
syslog(LOG_INFO, "Running command line: %s", cmdline);
|
||||||
if (svcname) {
|
if (svcname) {
|
||||||
start_time = time(NULL);
|
start_time = time(NULL);
|
||||||
rc_service_value_set(svcname, "start_time", from_time_t(start_time));
|
from_time_t(start_time_string, start_time);
|
||||||
|
rc_service_value_set(svcname, "start_time", start_time_string);
|
||||||
sprintf(start_count_string, "%i", start_count);
|
sprintf(start_count_string, "%i", start_count);
|
||||||
rc_service_value_set(svcname, "start_count", start_count_string);
|
rc_service_value_set(svcname, "start_count", start_count_string);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user