aboutsummaryrefslogtreecommitdiff
path: root/src/fs/fs_misc.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-12-26 19:31:18 +0000
committerChristian Grothoff <christian@grothoff.org>2011-12-26 19:31:18 +0000
commitc383f02c8b99a55d6d1c87b483a8819c81d5ea05 (patch)
tree1203ac4adece7aae2aae35df06ddc3bdc6745489 /src/fs/fs_misc.c
parent208eaf28f0a15033e1500373b0570918044e7c61 (diff)
downloadgnunet-c383f02c8b99a55d6d1c87b483a8819c81d5ea05.tar.gz
gnunet-c383f02c8b99a55d6d1c87b483a8819c81d5ea05.zip
adding GNUNET_FS_time_to_year function to FS API
Diffstat (limited to 'src/fs/fs_misc.c')
-rw-r--r--src/fs/fs_misc.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/fs/fs_misc.c b/src/fs/fs_misc.c
index d4afc0d55..89dc48683 100644
--- a/src/fs/fs_misc.c
+++ b/src/fs/fs_misc.c
@@ -207,6 +207,25 @@ GNUNET_FS_year_to_time (unsigned int year)
207} 207}
208 208
209 209
210/**
211 * Convert an expiration time to the respective year (rounds)
212 *
213 * @param at absolute time
214 * @return year a year (after 1970), 0 on error
215 */
216unsigned int
217GNUNET_FS_time_to_year (struct GNUNET_TIME_Absolute at)
218{
219 struct tm *t;
220 time_t tp;
221
222 tp = at.abs_value / 1000; /* ms to seconds */
223 t = gmtime (&tp);
224 if (t == NULL)
225 return 0;
226 return t->tm_year + 1900;
227
228}
210 229
211 230
212/* end of fs_misc.c */ 231/* end of fs_misc.c */