"Initial commit to Gerrit"
[profile/ivi/libgsf.git] / gsf / gsf-timestamp.h
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.h>
27 #include <glib-object.h>
28
29 G_BEGIN_DECLS
30
31 #define GSF_TIMESTAMP_TYPE      (gsf_timestamp_get_type ())
32 #define VAL_IS_GSF_TIMESTAMP(v) (G_TYPE_CHECK_VALUE_TYPE((v), GSF_TIMESTAMP_TYPE))
33
34 struct _GsfTimestamp {
35         GDate     date;                 /* In local timezone */
36         glong     seconds;              /* time of day */
37         GString   time_zone;            /* possibly blank */
38
39         guint32   timet;
40 };
41
42 GType gsf_timestamp_get_type      (void) G_GNUC_CONST;
43 /* void  gsf_timestamp_register_type (GTypeModule *module); glib dynamic types are not thread safe */
44
45 GsfTimestamp *gsf_timestamp_new (void);
46
47 GsfTimestamp *gsf_timestamp_copy        (GsfTimestamp const *stamp);
48 void          gsf_timestamp_free        (GsfTimestamp       *stamp);
49 int           gsf_timestamp_from_string (char const *spec, GsfTimestamp *stamp);
50 char         *gsf_timestamp_as_string   (GsfTimestamp const *stamp);
51 guint         gsf_timestamp_hash        (GsfTimestamp const *stamp);
52 gboolean      gsf_timestamp_equal       (GsfTimestamp const *a,
53                                          GsfTimestamp const *b);
54
55 void          gsf_timestamp_set_time    (GsfTimestamp *stamp, guint64 t);
56
57 void gsf_value_set_timestamp (GValue *value, GsfTimestamp const *stamp);
58
59 /* Deprecated */
60 int           gsf_timestamp_parse       (char const *spec, GsfTimestamp *stamp);
61
62 G_END_DECLS
63
64 #endif /* GSF_TIMESTAMP_H */