void get_file_timestamp_struct(uint64_t flags, struct tm *rectime,
struct file_header *file_hdr)
{
+ time_t t = file_hdr->sa_ust_time;
+
if (PRINT_TRUE_TIME(flags)) {
/* Get local time. This is just to fill fields with a default value. */
get_time(rectime, 0);
mktime(rectime);
}
else {
- localtime_r((const time_t *) &file_hdr->sa_ust_time, rectime);
+ localtime_r(&t, rectime);
}
}
struct tm *rectime)
{
struct tm *ltm;
+ time_t t = record_hdr->ust_time;
int rc = 0;
/*
* Fill generic rectime structure in local time.
* Done so that we have some default values.
*/
- ltm = localtime_r((const time_t *) &(record_hdr->ust_time), rectime);
+ ltm = localtime_r(&t, rectime);
if (!PRINT_LOCAL_TIME(l_flags) && !PRINT_TRUE_TIME(l_flags)) {
/*
* Get time in UTC
* (the user doesn't want local time nor time of file's creator).
*/
- ltm = gmtime_r((const time_t *) &(record_hdr->ust_time), rectime);
+ ltm = gmtime_r(&t, rectime);
}
if (!ltm) {
#ifdef HAVE_PCP
int rc;
struct tm lrectime;
+ time_t t = record_hdr->ust_time;
unsigned long long utc_sec = record_hdr->ust_time;
static long long delta_utc = LONG_MAX;
if (!PRINT_LOCAL_TIME(flags)) {
if (delta_utc == LONG_MAX) {
/* Convert a time_t value from local time to UTC */
- if (gmtime_r((const time_t *) &(record_hdr->ust_time), &lrectime)) {
+ if (gmtime_r(&t, &lrectime)) {
utc_sec = mktime(&lrectime);
delta_utc = utc_sec - record_hdr->ust_time;
}
struct file_activity *file_actlst)
{
struct tm rectime, loc_t;
+ time_t t = file_hdr->sa_ust_time;
char cur_time[TIMESTAMP_LEN];
int *tab = (int *) parm;
strftime(cur_time, sizeof(cur_time), "%Y-%m-%d", &rectime);
xprintf(*tab, "<file-date>%s</file-date>", cur_time);
- if (gmtime_r((const time_t *) &file_hdr->sa_ust_time, &loc_t) != NULL) {
+ if (gmtime_r(&t, &loc_t) != NULL) {
strftime(cur_time, sizeof(cur_time), "%T", &loc_t);
xprintf(*tab, "<file-utc-time>%s</file-utc-time>", cur_time);
}
struct file_activity *file_actlst)
{
struct tm rectime, loc_t;
+ time_t t = file_hdr->sa_ust_time;
char cur_time[TIMESTAMP_LEN];
int *tab = (int *) parm;
strftime(cur_time, sizeof(cur_time), "%Y-%m-%d", &rectime);
xprintf(*tab, "\"file-date\": \"%s\",", cur_time);
- if (gmtime_r((const time_t *) &file_hdr->sa_ust_time, &loc_t) != NULL) {
+ if (gmtime_r(&t, &loc_t) != NULL) {
strftime(cur_time, sizeof(cur_time), "%T", &loc_t);
xprintf(*tab, "\"file-utc-time\": \"%s\",", cur_time);
}
{
int i, p;
struct tm rectime, loc_t;
+ time_t t = file_hdr->sa_ust_time;
struct file_activity *fal;
char cur_time[TIMESTAMP_LEN];
file_magic->upgraded);
printf(_("Host: "));
- print_gal_header(localtime_r((const time_t *) &(file_hdr->sa_ust_time), &rectime),
+ print_gal_header(localtime_r(&t, &rectime),
file_hdr->sa_sysname, file_hdr->sa_release,
file_hdr->sa_nodename, file_hdr->sa_machine,
file_hdr->sa_cpu_nr > 1 ? file_hdr->sa_cpu_nr - 1 : 1,
strftime(cur_time, sizeof(cur_time), "%Y-%m-%d", &rectime);
printf(_("File date: %s\n"), cur_time);
- if (gmtime_r((const time_t *) &file_hdr->sa_ust_time, &loc_t) != NULL) {
+ if (gmtime_r(&t, &loc_t) != NULL) {
printf(_("File time: "));
strftime(cur_time, sizeof(cur_time), "%T", &loc_t);
printf("%s UTC (%lld)\n", cur_time, file_hdr->sa_ust_time);
{
struct svg_hdr_parm *hdr_parm = (struct svg_hdr_parm *) parm;
struct tm rectime;
+ time_t t = file_hdr->sa_ust_time;
unsigned int height = 0, ht = 0;
int i, p;
svg_colors[palette][SVG_COL_DEFAULT_IDX]);
printf("<text x=\"0\" y=\"30\" text-anchor=\"start\" stroke=\"#%06x\">",
svg_colors[palette][SVG_COL_HEADER_IDX]);
- print_gal_header(localtime_r((const time_t *) &(file_hdr->sa_ust_time), &rectime),
+ print_gal_header(localtime_r(&t, &rectime),
file_hdr->sa_sysname, file_hdr->sa_release,
file_hdr->sa_nodename, file_hdr->sa_machine,
file_hdr->sa_cpu_nr > 1 ? file_hdr->sa_cpu_nr - 1 : 1,
#ifdef HAVE_PCP
char buf[64];
struct tm lrectime;
+ time_t t = file_hdr->sa_ust_time;
unsigned long long utc_sec = file_hdr->sa_ust_time;
if (action & F_BEGIN) {
/* Only the header data will be written to PCP archive */
if (!PRINT_LOCAL_TIME(flags)) {
/* Convert a time_t value from local time to UTC */
- if (gmtime_r((const time_t *) &(file_hdr->sa_ust_time), &lrectime)) {
+ if (gmtime_r(&t, &lrectime)) {
utc_sec = mktime(&lrectime);
}
}