aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2009-06-11 05:30:19 +0000
committerChristian Grothoff <christian@grothoff.org>2009-06-11 05:30:19 +0000
commit8db4f9403d80faa67eaf85a2d077c35670596c4d (patch)
tree8aca077b466b92c2d6a296e186bad56f78f08f88 /src/util
parent4acd295ad6076d3c33f62d40324106d3308850ca (diff)
downloadgnunet-8db4f9403d80faa67eaf85a2d077c35670596c4d.tar.gz
gnunet-8db4f9403d80faa67eaf85a2d077c35670596c4d.zip
get time cfg api added
Diffstat (limited to 'src/util')
-rw-r--r--src/util/configuration.c18
-rw-r--r--src/util/service.c10
2 files changed, 23 insertions, 5 deletions
diff --git a/src/util/configuration.c b/src/util/configuration.c
index 4413b0377..eacbdbf05 100644
--- a/src/util/configuration.c
+++ b/src/util/configuration.c
@@ -402,6 +402,24 @@ GNUNET_CONFIGURATION_get_value_number (struct GNUNET_CONFIGURATION_Handle
402} 402}
403 403
404int 404int
405GNUNET_CONFIGURATION_get_value_time (struct GNUNET_CONFIGURATION_Handle
406 *cfg, const char *section,
407 const char *option,
408 struct GNUNET_TIME_Relative *time)
409{
410 unsigned long long num;
411 int ret;
412
413 ret = GNUNET_CONFIGURATION_get_value_number (cfg,
414 section,
415 option,
416 &num);
417 if (ret == GNUNET_OK)
418 time->value = (uint64_t) num;
419 return ret;
420}
421
422int
405GNUNET_CONFIGURATION_get_value_string (struct GNUNET_CONFIGURATION_Handle 423GNUNET_CONFIGURATION_get_value_string (struct GNUNET_CONFIGURATION_Handle
406 *cfg, const char *section, 424 *cfg, const char *section,
407 const char *option, char **value) 425 const char *option, char **value)
diff --git a/src/util/service.c b/src/util/service.c
index 8d72a749a..732dbe9af 100644
--- a/src/util/service.c
+++ b/src/util/service.c
@@ -754,7 +754,7 @@ static int
754setup_service (struct GNUNET_SERVICE_Context *sctx) 754setup_service (struct GNUNET_SERVICE_Context *sctx)
755{ 755{
756 unsigned long long maxbuf; 756 unsigned long long maxbuf;
757 unsigned long long idleout; 757 struct GNUNET_TIME_Relative idleout;
758 char *hostname; 758 char *hostname;
759 unsigned long long port; 759 unsigned long long port;
760 int disablev6; 760 int disablev6;
@@ -768,12 +768,12 @@ setup_service (struct GNUNET_SERVICE_Context *sctx)
768 sctx->serviceName, "TIMEOUT")) 768 sctx->serviceName, "TIMEOUT"))
769 { 769 {
770 if (GNUNET_OK != 770 if (GNUNET_OK !=
771 GNUNET_CONFIGURATION_get_value_number (sctx->cfg, 771 GNUNET_CONFIGURATION_get_value_time (sctx->cfg,
772 sctx->serviceName, 772 sctx->serviceName,
773 "TIMEOUT", &idleout)) 773 "TIMEOUT", &idleout))
774 return GNUNET_SYSERR; 774 return GNUNET_SYSERR;
775 775
776 sctx->timeout.value = idleout; 776 sctx->timeout = idleout;
777 } 777 }
778 else 778 else
779 sctx->timeout = GNUNET_TIME_UNIT_FOREVER_REL; 779 sctx->timeout = GNUNET_TIME_UNIT_FOREVER_REL;