Headers for Greenbone Vulnerability Manager: General utilities.
More...
#include <glib.h>
#include <time.h>
Go to the source code of this file.
Headers for Greenbone Vulnerability Manager: General utilities.
◆ days_from_now()
int days_from_now |
( |
time_t * |
epoch_time | ) |
|
Calculate difference between now and epoch_time in days.
- Parameters
-
[in] | epoch_time | Time in seconds from epoch. |
- Returns
- Int days bettween now and epoch_time or -1 if epoch_time is in the past
◆ gvm_sleep()
int gvm_sleep |
( |
unsigned int |
seconds | ) |
|
Sleep for some number of seconds, handling interrupts.
- Parameters
-
[in] | seconds | Number of seconds. |
- Returns
- 0 success, -1 error (with errno set).
◆ gvm_usleep()
int gvm_usleep |
( |
unsigned int |
microseconds | ) |
|
Sleep for some number of microseconds, handling interrupts.
- Parameters
-
[in] | microseconds | Number of microseconds. |
- Returns
- 0 success, -1 error (with errno set).
◆ iso_time()
char* iso_time |
( |
time_t * |
epoch_time | ) |
|
Create an ISO time from seconds since epoch.
- Parameters
-
[in] | epoch_time | Time in seconds from epoch. |
- Returns
- Pointer to ISO time in static memory, or NULL on error.
◆ iso_time_tz()
char* iso_time_tz |
( |
time_t * |
epoch_time, |
|
|
const char * |
zone, |
|
|
const char ** |
abbrev |
|
) |
| |
Create an ISO time from seconds since epoch, given a timezone.
- Parameters
-
[in] | epoch_time | Time in seconds from epoch. |
[in] | zone | Timezone. |
[out] | abbrev | Timezone abbreviation. |
- Returns
- Pointer to ISO time in static memory, or NULL on error.
◆ lockfile_lock()
int lockfile_lock |
( |
lockfile_t * |
lockfile, |
|
|
const gchar * |
lockfile_basename |
|
) |
| |
Lock a file exclusively.
Block until file is locked.
- Parameters
-
[in] | lockfile | Lockfile. |
[in] | lockfile_basename | Basename of lock file. |
- Returns
- 0 success, 1 already locked, -1 error
◆ lockfile_lock_nb()
int lockfile_lock_nb |
( |
lockfile_t * |
lockfile, |
|
|
const gchar * |
lockfile_basename |
|
) |
| |
Lock a file exclusively, without blocking.
- Parameters
-
[in] | lockfile | Lockfile. |
[in] | lockfile_basename | Basename of lock file. |
- Returns
- 0 success, 1 already locked, -1 error
◆ lockfile_lock_shared_nb()
int lockfile_lock_shared_nb |
( |
lockfile_t * |
lockfile, |
|
|
const gchar * |
lockfile_basename |
|
) |
| |
Lock a file with a shared lock.
- Parameters
-
[in] | lockfile | Lockfile. |
[in] | lockfile_basename | Basename of lock file. |
- Returns
- 0 success, 1 already locked, -1 error
◆ lockfile_locked()
int lockfile_locked |
( |
const gchar * |
lockfile_basename | ) |
|
Check if a file is locked.
- Parameters
-
[in] | lockfile_basename | Basename of lock file. |
- Returns
- 0 free, 1 locked, -1 error
◆ lockfile_unlock()
Unlock a file.
- Parameters
-
- Returns
- 0 success, -1 error
◆ parse_ctime()
int parse_ctime |
( |
const char * |
text_time | ) |
|
Convert a ctime into seconds since epoch.
Use the current timezone.
- Parameters
-
[in] | text_time | Time as text in ctime format. |
- Returns
- Time since epoch.
◆ parse_feed_timestamp()
int parse_feed_timestamp |
( |
const char * |
text_time | ) |
|
Convert a feed timestamp into seconds since epoch.
- Parameters
-
[in] | text_time | Time as text in ctime format. |
- Returns
- Time since epoch. 0 on error.
◆ parse_utc_ctime()
int parse_utc_ctime |
( |
const char * |
text_time | ) |
|
Convert a UTC ctime string into seconds since the epoch.
- Parameters
-
[in] | text_time | Time as text in ctime format. |
- Returns
- Time since epoch. 0 on error.