Пример #1
0
int
pmiWrite(int sec, int usec)
{
    int		sts;

    if (current == NULL)
	return PM_ERR_NOCONTEXT;
    if (current->result == NULL)
	return current->last_sts = PMI_ERR_NODATA;

    if (sec < 0) {
	pmtimevalNow(&current->result->timestamp);
    }
    else {
	current->result->timestamp.tv_sec = sec;
	current->result->timestamp.tv_usec = usec;
    }
    if ((sts = check_timestamp()) == 0) {
	sts = _pmi_put_result(current, current->result);
	current->last_stamp = current->result->timestamp;
    }

    pmFreeResult(current->result);
    current->result = NULL;

    return current->last_sts = sts;
}
Пример #2
0
int
pmiPutResult(const pmResult *result)
{
    if (current == NULL)
	return PM_ERR_NOCONTEXT;

    return  current->last_sts = _pmi_put_result(current, current->result);
}
Пример #3
0
int
pmiPutResult(const pmResult *result)
{
    int		sts;

    if (current == NULL)
	return PM_ERR_NOCONTEXT;

    current->result = (pmResult *)result;
    if ((sts = check_timestamp()) == 0) {
	sts = _pmi_put_result(current, current->result);
	current->last_stamp = current->result->timestamp;
    }
    current->result = NULL;

    return current->last_sts = sts;
}
Пример #4
0
int
pmiWrite(int sec, int usec)
{
    int		sts;

    if (current == NULL)
	return PM_ERR_NOCONTEXT;
    if (current->result == NULL)
	return current->last_sts = PMI_ERR_NODATA;

    if (sec < 0) {
	__pmtimevalNow(&current->result->timestamp);
    }
    else {
	current->result->timestamp.tv_sec = sec;
	current->result->timestamp.tv_usec = usec;
    }
    if (current->result->timestamp.tv_sec < current->last_stamp.tv_sec ||
        (current->result->timestamp.tv_sec == current->last_stamp.tv_sec &&
	 current->result->timestamp.tv_usec < current->last_stamp.tv_usec)) {
	fprintf(stderr, "Fatal Error: timestamp ");
	printstamp(stderr, &current->result->timestamp);
	fprintf(stderr, " not greater than previous valid timestamp ");
	printstamp(stderr, &current->last_stamp);
	fputc('\n', stderr);
	sts = PMI_ERR_BADTIMESTAMP;
    }
    else {
	sts = _pmi_put_result(current, current->result);
	current->last_stamp = current->result->timestamp;
    }

    pmFreeResult(current->result);
    current->result = NULL;

    return current->last_sts = sts;
}