diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-09-16 11:27:08 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-09-16 11:27:08 +0000 |
commit | f736b24935d66733e9a53798fbc87dbc8aff9fca (patch) | |
tree | b7f865216ca4b40a4a6e4535dfa6677700a27efc /src/util/time.c | |
parent | c5784d2c94adcf1fe80e88c9ab1c152ce2fcbe95 (diff) | |
download | gnunet-f736b24935d66733e9a53798fbc87dbc8aff9fca.tar.gz gnunet-f736b24935d66733e9a53798fbc87dbc8aff9fca.zip |
-fixing #2546
Diffstat (limited to 'src/util/time.c')
-rw-r--r-- | src/util/time.c | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/src/util/time.c b/src/util/time.c index 7467b4497..afb0c00c1 100644 --- a/src/util/time.c +++ b/src/util/time.c | |||
@@ -484,6 +484,7 @@ GNUNET_TIME_relative_hton (struct GNUNET_TIME_Relative a) | |||
484 | return ret; | 484 | return ret; |
485 | } | 485 | } |
486 | 486 | ||
487 | |||
487 | /** | 488 | /** |
488 | * Convert relative time from network byte order. | 489 | * Convert relative time from network byte order. |
489 | * | 490 | * |
@@ -500,6 +501,7 @@ GNUNET_TIME_relative_ntoh (struct GNUNET_TIME_RelativeNBO a) | |||
500 | 501 | ||
501 | } | 502 | } |
502 | 503 | ||
504 | |||
503 | /** | 505 | /** |
504 | * Convert absolute time to network byte order. | 506 | * Convert absolute time to network byte order. |
505 | * | 507 | * |
@@ -515,6 +517,7 @@ GNUNET_TIME_absolute_hton (struct GNUNET_TIME_Absolute a) | |||
515 | return ret; | 517 | return ret; |
516 | } | 518 | } |
517 | 519 | ||
520 | |||
518 | /** | 521 | /** |
519 | * Convert absolute time from network byte order. | 522 | * Convert absolute time from network byte order. |
520 | * | 523 | * |
@@ -531,26 +534,5 @@ GNUNET_TIME_absolute_ntoh (struct GNUNET_TIME_AbsoluteNBO a) | |||
531 | 534 | ||
532 | } | 535 | } |
533 | 536 | ||
534 | /** | ||
535 | * Convert a relative time to a string. | ||
536 | * This is one of the very few calls in the entire API that is | ||
537 | * NOT reentrant! | ||
538 | * | ||
539 | * @param time the time to print | ||
540 | * | ||
541 | * @return string form of the time (as milliseconds) | ||
542 | */ | ||
543 | const char * | ||
544 | GNUNET_TIME_relative_to_string (struct GNUNET_TIME_Relative time) | ||
545 | { | ||
546 | static char time_string[21]; | ||
547 | |||
548 | memset (time_string, 0, sizeof (time_string)); | ||
549 | |||
550 | sprintf (time_string, "%llu", (unsigned long long) time.rel_value); | ||
551 | return (const char *) time_string; | ||
552 | } | ||
553 | |||
554 | |||
555 | 537 | ||
556 | /* end of time.c */ | 538 | /* end of time.c */ |