예제 #1
0
/**
 * idmef_time_new_from_timeval:
 * @time: Address where to store the created #idmef_time_t object.
 * @tv: Pointer to a struct timeval (see gettimeofday()).
 *
 * Creates an #idmef_time_t object filled with information provided
 * within the @tv structure.
 *
 * Returns: 0 on success, a negative value if an error occured.
 */
int idmef_time_new_from_timeval(idmef_time_t **time, const struct timeval *tv)
{
        int ret;

        prelude_return_val_if_fail(tv, prelude_error(PRELUDE_ERROR_ASSERTION));

        ret = idmef_time_new(time);
        if ( ret < 0 )
                return ret;

        return idmef_time_set_from_timeval(*time, tv);
}
예제 #2
0
/**
 * idmef_time_clone:
 * @src: Pointer to a #idmef_time_t to clone.
 * @dst: Address where to store the cloned @src object.
 *
 * Clones @src and stores the result in the @dst address.
 *
 * Returns: 0 on success, a negative value if an error occured.
 */
int idmef_time_clone(const idmef_time_t *src, idmef_time_t **dst)
{
        int ret;

        prelude_return_val_if_fail(src, prelude_error(PRELUDE_ERROR_ASSERTION));

        ret = idmef_time_new(dst);
        if ( ret < 0 )
                return ret;

        return idmef_time_copy(src, *dst);
}
예제 #3
0
/**
 * idmef_time_new_from_timeval:
 * @time: Address where to store the created #idmef_time_t object.
 * @tv: Pointer to a struct timeval (see gettimeofday()).
 *
 * Creates an #idmef_time_t object filled with information provided
 * within the @tv structure.
 *
 * Returns: 0 on success, a negative value if an error occured.
 */
int idmef_time_new_from_timeval(idmef_time_t **time, const struct timeval *tv)
{
        int ret;

        libidmef_return_val_if_fail(tv, libidmef_error(LIBIDMEF_ERROR_ASSERTION));

        ret = idmef_time_new(time);
        if ( ret < 0 )
                return ret;

        return idmef_time_set_from_timeval(*time, tv);
}
예제 #4
0
/**
 * idmef_time_clone:
 * @src: Pointer to a #idmef_time_t to clone.
 * @dst: Address where to store the cloned @src object.
 *
 * Clones @src and stores the result in the @dst address.
 *
 * Returns: 0 on success, a negative value if an error occured.
 */
int idmef_time_clone(const idmef_time_t *src, idmef_time_t **dst)
{
        int ret;

        libidmef_return_val_if_fail(src, libidmef_error(LIBIDMEF_ERROR_ASSERTION));

        ret = idmef_time_new(dst);
        if ( ret < 0 )
                return ret;

        return idmef_time_copy(src, *dst);
}
예제 #5
0
/**
 * idmef_time_clone:
 * @src: Pointer to a #idmef_time_t to clone.
 * @dst: Address where to store the cloned @src object.
 *
 * Clones @src and stores the result in the @dst address.
 *
 * Returns: 0 on success, a negative value if an error occured.
 */
int idmef_time_clone(const idmef_time_t *src, idmef_time_t **dst)
{
        int ret;

        requiem_return_val_if_fail(src, requiem_error(REQUIEM_ERROR_ASSERTION));

        ret = idmef_time_new(dst);
        if ( ret < 0 )
                return ret;

        return idmef_time_copy(src, *dst);
}
예제 #6
0
/**
 * idmef_time_new_from_timeval:
 * @time: Address where to store the created #idmef_time_t object.
 * @tv: Pointer to a struct timeval (see gettimeofday()).
 *
 * Creates an #idmef_time_t object filled with information provided
 * within the @tv structure.
 *
 * Returns: 0 on success, a negative value if an error occured.
 */
int idmef_time_new_from_timeval(idmef_time_t **time, const struct timeval *tv)
{
        int ret;

        requiem_return_val_if_fail(tv, requiem_error(REQUIEM_ERROR_ASSERTION));

        ret = idmef_time_new(time);
        if ( ret < 0 )
                return ret;

        return idmef_time_set_from_timeval(*time, tv);
}
예제 #7
0
/**
 * idmef_time_new_from_time:
 * @time: Address where to store the created #idmef_time_t object.
 * @t: Pointer to a time_t.
 *
 * Creates a new #idmef_time_t object and store it in @time.
 * This object will be filled with information available in @t. The created
 * @time won't contain micro seconds information, since theses are not
 * available within @t.
 *
 * Returns: 0 on success, a negative value if an error occured.
 */
int idmef_time_new_from_time(idmef_time_t **time, const time_t *t)
{
        int ret;

        prelude_return_val_if_fail(t, prelude_error(PRELUDE_ERROR_ASSERTION));

        ret = idmef_time_new(time);
        if ( ret < 0 )
                return ret;

        idmef_time_set_from_time(*time, t);

        return 0;
}
예제 #8
0
/**
 * idmef_time_new_from_time:
 * @time: Address where to store the created #idmef_time_t object.
 * @t: Pointer to a time_t.
 *
 * Creates a new #idmef_time_t object and store it in @time.
 * This object will be filled with information available in @t. The created
 * @time won't contain micro seconds information, since theses are not
 * available within @t.
 *
 * Returns: 0 on success, a negative value if an error occured.
 */
int idmef_time_new_from_time(idmef_time_t **time, const time_t *t)
{
        int ret;

        libidmef_return_val_if_fail(t, libidmef_error(LIBIDMEF_ERROR_ASSERTION));

        ret = idmef_time_new(time);
        if ( ret < 0 )
                return ret;

        idmef_time_set_from_time(*time, t);

        return 0;
}
예제 #9
0
/**
 * idmef_time_new_from_time:
 * @time: Address where to store the created #idmef_time_t object.
 * @t: Pointer to a time_t.
 *
 * Creates a new #idmef_time_t object and store it in @time.
 * This object will be filled with information available in @t. The created
 * @time won't contain micro seconds information, since theses are not
 * available within @t.
 *
 * Returns: 0 on success, a negative value if an error occured.
 */
int idmef_time_new_from_time(idmef_time_t **time, const time_t *t)
{
        int ret;

        requiem_return_val_if_fail(t, requiem_error(REQUIEM_ERROR_ASSERTION));

        ret = idmef_time_new(time);
        if ( ret < 0 )
                return ret;

        idmef_time_set_from_time(*time, t);

        return 0;
}
예제 #10
0
/**
 * idmef_time_new_from_ntpstamp:
 * @time: Address where to store the created #idmef_time_t object.
 * @buf: Pointer to a string containing an NTP timestamp.
 *
 * Creates an #idmef_time_t object filled with information provided
 * from the @buf NTP timestamp, and stores it in @time.
 *
 * Returns: 0 on success, a negative value if an error occured.
 */
int idmef_time_new_from_ntpstamp(idmef_time_t **time, const char *buf)
{
        int ret;

        prelude_return_val_if_fail(buf, prelude_error(PRELUDE_ERROR_ASSERTION));

        ret = idmef_time_new(time);
        if ( ret < 0 )
                return ret;

        ret = idmef_time_set_from_ntpstamp(*time, buf);
        if ( ret < 0 ) {
                free(*time);
                return ret;
        }

        return 0;
}
예제 #11
0
/**
 * idmef_time_new_from_ntpstamp:
 * @time: Address where to store the created #idmef_time_t object.
 * @buf: Pointer to a string containing an NTP timestamp.
 *
 * Creates an #idmef_time_t object filled with information provided
 * from the @buf NTP timestamp, and stores it in @time.
 *
 * Returns: 0 on success, a negative value if an error occured.
 */
int idmef_time_new_from_ntpstamp(idmef_time_t **time, const char *buf)
{
        int ret;

        libidmef_return_val_if_fail(buf, libidmef_error(LIBIDMEF_ERROR_ASSERTION));

        ret = idmef_time_new(time);
        if ( ret < 0 )
                return ret;

        ret = idmef_time_set_from_ntpstamp(*time, buf);
        if ( ret < 0 ) {
                free(*time);
                return ret;
        }

        return 0;
}
예제 #12
0
/**
 * idmef_time_new_from_ntpstamp:
 * @time: Address where to store the created #idmef_time_t object.
 * @buf: Pointer to a string containing an NTP timestamp.
 *
 * Creates an #idmef_time_t object filled with information provided
 * from the @buf NTP timestamp, and stores it in @time.
 *
 * Returns: 0 on success, a negative value if an error occured.
 */
int idmef_time_new_from_ntpstamp(idmef_time_t **time, const char *buf)
{
        int ret;

        requiem_return_val_if_fail(buf, requiem_error(REQUIEM_ERROR_ASSERTION));

        ret = idmef_time_new(time);
        if ( ret < 0 )
                return ret;

        ret = idmef_time_set_from_ntpstamp(*time, buf);
        if ( ret < 0 ) {
                free(*time);
                return ret;
        }

        return 0;
}