posix_trace_attr_getcreatetime Subroutine

Purpose

Retrieves the creation time of a trace stream.

Library

Posix Trace Library (libposixtrace.a)

Syntax

#include <time.h>
#include <trace.h>

int posix_trace_attr_getcreatetime(attr, createtime)
const trace_attr_t *attr;
struct timespec *createtime;

Description

The posix_trace_attr_getcreatetime subroutine copies the amount of time to create a trace stream from the creation-time attribute of the attr object into the createtime parameter. The value of the createtime parameter is a structure.

The timespec struct defines that the value of the creation-time attribute is a structure. The creation-time attribute is set with the clock_gettime subroutine. The clock_gettime subroutine returns the amount of time (in seconds and nanoseconds) since the epoch. The timespec struct is defined as the following:
struct timespec {
    time_t tv_sec;         /* seconds */
    long   tv_nsec;        /* and nanoseconds */
};

If the posix_trace_attr_getcreatetime subroutine is called with a non-initialized attributes object as parameter, the result is not specified.

Parameters

Item Description
attr Specifies the trace attributes object.
createtime Specifies where the creation-time attribute is stored.

Return Values

Upon successful completion, it returns a value of zero. Otherwise, it returns the corresponding error number.

If successful, the posix_trace_attr_getcreatetime subroutine stores the trace stream creation time in the createtime parameter. Otherwise, the content of this object is not specified.

Errors

The posix_trace_attr_getcreatetime subroutine fails if the following error number returns:
Item Description
EINVAL One of the parameters is null. Or the trace attributes object is not retrieved with the posix_trace_get_attr subroutine on a stream.

Files

The trace.h file in Files Reference