From 59f7647cd97c62ab7a26725e5a166dcb54b27bc6 Mon Sep 17 00:00:00 2001 From: Aris Adamantiadis Date: Tue, 24 May 2011 23:26:18 +0200 Subject: Introduced ssh_timeout_elapsed functions Functions to mesure elapsed time before and after a serie of calls. Introduces a dependancy to clock_gettime() and librt, hope this doesn't break anything. Porting to gettimeofday() should not be too hard. --- include/libssh/misc.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include/libssh/misc.h') diff --git a/include/libssh/misc.h b/include/libssh/misc.h index 3ee26a3..9897c4e 100644 --- a/include/libssh/misc.h +++ b/include/libssh/misc.h @@ -50,6 +50,11 @@ struct ssh_iterator { const void *data; }; +struct ssh_timestamp { + long seconds; + long useconds; +}; + struct ssh_list *ssh_list_new(void); void ssh_list_free(struct ssh_list *list); struct ssh_iterator *ssh_list_get_iterator(const struct ssh_list *list); @@ -72,4 +77,8 @@ const void *_ssh_list_pop_head(struct ssh_list *list); #define ssh_list_pop_head(type, ssh_list)\ ((type)_ssh_list_pop_head(ssh_list)) +void ssh_timestamp_init(struct ssh_timestamp *ts); +int ssh_timeout_elapsed(struct ssh_timestamp *ts, int timeout); +int ssh_timeout_update(struct ssh_timestamp *ts, int timeout); + #endif /* MISC_H_ */ -- cgit