diff options
| author | Frederic Peters <fpeters@entrouvert.com> | 2004-10-28 14:47:36 +0000 |
|---|---|---|
| committer | Frederic Peters <fpeters@entrouvert.com> | 2004-10-28 14:47:36 +0000 |
| commit | 50d998ebcd56c7c9e29b7bd7c8fe07fe3e05222f (patch) | |
| tree | cf034919fdc122f54882f19515a09455ad59591d | |
| parent | 543c07ef61d0b7fbb533ebfd2628581657182f43 (diff) | |
| download | lasso-50d998ebcd56c7c9e29b7bd7c8fe07fe3e05222f.tar.gz lasso-50d998ebcd56c7c9e29b7bd7c8fe07fe3e05222f.tar.xz lasso-50d998ebcd56c7c9e29b7bd7c8fe07fe3e05222f.zip | |
fixed lasso_get_current_time to return UTC time
| -rw-r--r-- | lasso/xml/tools.c | 18 | ||||
| -rw-r--r-- | lasso/xml/tools.h | 2 |
2 files changed, 11 insertions, 9 deletions
diff --git a/lasso/xml/tools.c b/lasso/xml/tools.c index 722e0b76..01178a6b 100644 --- a/lasso/xml/tools.c +++ b/lasso/xml/tools.c @@ -24,6 +24,7 @@ */ #include <string.h> +#include <time.h> #include <libxml/uri.h> @@ -115,18 +116,19 @@ lasso_build_unique_id(guint8 size) * * Return value: a string **/ -gchar * +char* lasso_get_current_time() { - struct tm *tm; - GTimeVal time_val; - gchar *ret = g_new0(gchar, 21); + time_t now; + struct tm *tm; + char *ret; - g_get_current_time(&time_val); - tm = localtime(&(time_val.tv_sec)); - strftime(ret, 21, "%Y-%m-%dT%H:%M:%SZ", tm); + ret = malloc(21); + now = time(NULL); + tm = gmtime(&now); + strftime(ret, 21, "%Y-%m-%dT%H:%M:%SZ", tm); - return ret; + return ret; } /** diff --git a/lasso/xml/tools.h b/lasso/xml/tools.h index 114d6b8c..ba8488a6 100644 --- a/lasso/xml/tools.h +++ b/lasso/xml/tools.h @@ -56,7 +56,7 @@ LASSO_EXPORT xmlChar* lasso_build_random_sequence (guint LASSO_EXPORT xmlChar* lasso_build_unique_id (guint8 size); -LASSO_EXPORT gchar* lasso_get_current_time (void); +LASSO_EXPORT char* lasso_get_current_time(void); LASSO_EXPORT lassoPemFileType lasso_get_pem_file_type (const gchar *pem_file); |
