/** * 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); }
/** * 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); }
/** * 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); }
/** * idmef_time_set_from_gettimeofday: * @time: Pointer to an #idmef_time_t object. * * Fills @time with information retrieved using gettimeofday(). * * Returns: 0 on success, a negative value if an error occured. */ int idmef_time_set_from_gettimeofday(idmef_time_t *time) { int ret; struct timeval tv; prelude_return_val_if_fail(time, prelude_error(PRELUDE_ERROR_ASSERTION)); ret = gettimeofday(&tv, NULL); if ( ret < 0 ) return prelude_error_from_errno(errno); return idmef_time_set_from_timeval(time, &tv); }
/** * idmef_time_set_from_gettimeofday: * @time: Pointer to an #idmef_time_t object. * * Fills @time with information retrieved using gettimeofday(). * * Returns: 0 on success, a negative value if an error occured. */ int idmef_time_set_from_gettimeofday(idmef_time_t *time) { int ret; struct timeval tv; libidmef_return_val_if_fail(time, libidmef_error(LIBIDMEF_ERROR_ASSERTION)); ret = gettimeofday(&tv, NULL); if ( ret < 0 ) return libidmef_error_from_errno(errno); return idmef_time_set_from_timeval(time, &tv); }
/** * idmef_time_set_from_gettimeofday: * @time: Pointer to an #idmef_time_t object. * * Fills @time with information retrieved using gettimeofday(). * * Returns: 0 on success, a negative value if an error occured. */ int idmef_time_set_from_gettimeofday(idmef_time_t *time) { int ret; struct timeval tv; requiem_return_val_if_fail(time, requiem_error(REQUIEM_ERROR_ASSERTION)); ret = gettimeofday(&tv, NULL); if ( ret < 0 ) return requiem_error_from_errno(errno); return idmef_time_set_from_timeval(time, &tv); }