/*
This file is part of GNUnet.
- (C) 2010, 2011 Christian Grothoff (and other contributing authors)
+ Copyright (C) 2010, 2011, 2017 GNUnet e.V.
- GNUnet is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published
- by the Free Software Foundation; either version 3, or (at your
- option) any later version.
+ GNUnet is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License,
+ or (at your option) any later version.
GNUnet is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
+ Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
- You should have received a copy of the GNU General Public License
- along with GNUnet; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
+ SPDX-License-Identifier: AGPL3.0-or-later
*/
/**
* @file fs/fs_misc.c
{"application/gnunet-directory", ".gnd"},
{"application/java", ".class"},
{"application/msword", ".doc"},
+ {"application/nar", ".nar"},
+ {"application/narinfo", ".narinfo"},
{"application/ogg", ".ogg"},
{"application/pdf", ".pdf"},
{"application/pgp-keys", ".key"},
{"application/xml", ".xml"},
{"application/x-debian-package", ".deb"},
{"application/x-dvi", ".dvi"},
- {"applixation/x-flac", ".flac"},
- {"applixation/x-gzip", ".gz"},
+ {"application/x-flac", ".flac"},
+ {"application/x-gzip", ".gz"},
{"application/x-java-archive", ".jar"},
{"application/x-java-vm", ".class"},
{"application/x-python-code", ".pyc"},
}
-/**
- * Return the current year (i.e. '2011').
- */
-unsigned int
-GNUNET_FS_get_current_year ()
-{
- time_t tp;
- struct tm *t;
-
- tp = time (NULL);
- t = gmtime (&tp);
- if (t == NULL)
- return 0;
- return t->tm_year + 1900;
-}
-
-
-/**
- * Convert a year to an expiration time of January 1st of that year.
- *
- * @param year a year (after 1970, please ;-)).
- * @return absolute time for January 1st of that year.
- */
-struct GNUNET_TIME_Absolute
-GNUNET_FS_year_to_time (unsigned int year)
-{
- struct GNUNET_TIME_Absolute ret;
- time_t tp;
- struct tm t;
-
- memset (&t, 0, sizeof (t));
- if (year < 1900)
- {
- GNUNET_break (0);
- return GNUNET_TIME_absolute_get (); /* now */
- }
- t.tm_year = year - 1900;
- t.tm_mday = 1;
- t.tm_mon = 1;
- t.tm_wday = 1;
- t.tm_yday = 1;
- tp = mktime (&t);
- GNUNET_break (tp != (time_t) - 1);
- ret.abs_value_us = tp * 1000LL * 1000LL; /* seconds to microseconds */
- return ret;
-}
-
-
-/**
- * Convert an expiration time to the respective year (rounds)
- *
- * @param at absolute time
- * @return year a year (after 1970), 0 on error
- */
-unsigned int
-GNUNET_FS_time_to_year (struct GNUNET_TIME_Absolute at)
-{
- struct tm *t;
- time_t tp;
-
- tp = at.abs_value_us / 1000LL / 1000LL; /* microseconds to seconds */
- t = gmtime (&tp);
- if (t == NULL)
- return 0;
- return t->tm_year + 1900;
-
-}
-
-
/* end of fs_misc.c */