1 /* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3  * gsf-timestamp.h: A useful little type for metadata, contains a superset of
4  *		 all the features it would be nice to have.
5  *
6  * Copyright (C) 2002-2006 Jody Goldberg (jody@gnome.org)
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of version 2.1 of the GNU Lesser General Public
10  * License as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
20  * USA
21  */
22 
23 #ifndef GSF_TIMESTAMP_H
24 #define GSF_TIMESTAMP_H
25 
26 #include <gsf/gsf-fwd.h>
27 
28 G_BEGIN_DECLS
29 
30 #define GSF_TIMESTAMP_TYPE      (gsf_timestamp_get_type ())
31 #define VAL_IS_GSF_TIMESTAMP(v) (G_TYPE_CHECK_VALUE_TYPE((v), GSF_TIMESTAMP_TYPE))
32 
33 struct _GsfTimestamp {
34 	GDate	  date;			/* In local timezone */
35 	glong     seconds;		/* time of day */
36 	GString	  time_zone;		/* possibly blank */
37 
38 	guint32	  timet;
39 };
40 
41 GType gsf_timestamp_get_type      (void);
42 /* void  gsf_timestamp_register_type (GTypeModule *module); glib dynamic types are not thread safe */
43 
44 GsfTimestamp *gsf_timestamp_new	(void);
45 
46 GsfTimestamp *gsf_timestamp_copy	(GsfTimestamp const *stamp);
47 void          gsf_timestamp_free	(GsfTimestamp       *stamp);
48 int	      gsf_timestamp_load_from_string (GsfTimestamp *stamp, char const *spec);
49 char 	     *gsf_timestamp_as_string	(GsfTimestamp const *stamp);
50 guint         gsf_timestamp_hash	(GsfTimestamp const *stamp);
51 gboolean      gsf_timestamp_equal	(GsfTimestamp const *a,
52 					 GsfTimestamp const *b);
53 
54 void          gsf_timestamp_set_time    (GsfTimestamp *stamp, guint64 t);
55 
56 void gsf_timestamp_to_value (GsfTimestamp const *stamp, GValue *value);
57 
58 /* Deprecated */
59 #ifndef GSF_DISABLE_DEPRECATED
60 G_DEPRECATED_FOR(gsf_timestamp_to_value)
61 void gsf_value_set_timestamp (GValue *value, GsfTimestamp const *stamp);
62 G_DEPRECATED_FOR(gsf_timestamp_load_from_string)
63 int	      gsf_timestamp_from_string (char const *spec, GsfTimestamp *stamp);
64 G_DEPRECATED_FOR(gsf_timestamp_load_from_string)
65 int           gsf_timestamp_parse	(char const *spec, GsfTimestamp *stamp);
66 #endif
67 
68 G_END_DECLS
69 
70 #endif /* GSF_TIMESTAMP_H */
71