aboutsummaryrefslogtreecommitdiff
path: root/src/fs/fs_misc.c
diff options
context:
space:
mode:
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 */