loudmouth/lm-utils.c
author Mikael Berthe <mikael@lilotux.net>
Mon, 25 Jan 2016 18:35:10 +0100
changeset 685 dfa02c1c7fda
parent 607 e2bd14357c9a
child 690 7ccf2113ec5f
permissions -rw-r--r--
Bumped version to 1.5.2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
516
4dd3aa6b83e5 Change the tab width to 4 steps in the emacs headers
Mikael Hallendal <micke@imendio.com>
parents: 515
diff changeset
     1
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
1
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
     2
/*
607
e2bd14357c9a Some style fixes
Frank Zschockelt <lm@freakysoft.de>
parents: 533
diff changeset
     3
 * Copyright (C) 2003 Imendio AB
1
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
     4
 *
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
     6
 * modify it under the terms of the GNU Lesser General Public License as
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
     7
 * published by the Free Software Foundation; either version 2 of the
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
     8
 * License, or (at your option) any later version.
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
     9
 *
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    10
 * This program is distributed in the hope that it will be useful,
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    13
 * Lesser General Public License for more details.
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    14
 *
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    15
 * You should have received a copy of the GNU Lesser General Public
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    16
 * License along with this program; if not, write to the
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    17
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    18
 * Boston, MA 02111-1307, USA.
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    19
 */
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    20
417
364c17252e5f Added inlined documentation from generated through the Gtk-doc migration script.
Mikael Hallendal <micke@imendio.com>
parents: 407
diff changeset
    21
/**
420
f40434cca022 Fixed the SECTION parts of the inlined docs so that gtk-doc finds them.
Mikael Hallendal <micke@imendio.com>
parents: 417
diff changeset
    22
 * SECTION:lm-utils
421
2a91651d22de Added Title to the inlined documentation
Mikael Hallendal <micke@imendio.com>
parents: 420
diff changeset
    23
 * @Title: Miscellaneous Utility Functions
420
f40434cca022 Fixed the SECTION parts of the inlined docs so that gtk-doc finds them.
Mikael Hallendal <micke@imendio.com>
parents: 417
diff changeset
    24
 * @Short_description: Miscellaneous Utility Functions
607
e2bd14357c9a Some style fixes
Frank Zschockelt <lm@freakysoft.de>
parents: 533
diff changeset
    25
 *
417
364c17252e5f Added inlined documentation from generated through the Gtk-doc migration script.
Mikael Hallendal <micke@imendio.com>
parents: 407
diff changeset
    26
 * Functions to help application developers when writing XMPP applications using Loudmouth.
364c17252e5f Added inlined documentation from generated through the Gtk-doc migration script.
Mikael Hallendal <micke@imendio.com>
parents: 407
diff changeset
    27
 */
364c17252e5f Added inlined documentation from generated through the Gtk-doc migration script.
Mikael Hallendal <micke@imendio.com>
parents: 407
diff changeset
    28
1
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    29
#include <config.h>
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    30
#include <string.h>
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    31
#include <stdio.h>
155
d24c4392d4e3 2006-06-16 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents: 140
diff changeset
    32
#include <stdlib.h>
1
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    33
#include <time.h>
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    34
140
103227122f45 2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents: 99
diff changeset
    35
#include <glib.h>
103227122f45 2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents: 99
diff changeset
    36
103227122f45 2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents: 99
diff changeset
    37
#ifndef G_OS_WIN32
103227122f45 2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents: 99
diff changeset
    38
#include <unistd.h>
103227122f45 2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents: 99
diff changeset
    39
#endif
103227122f45 2006-04-19 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents: 99
diff changeset
    40
155
d24c4392d4e3 2006-06-16 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents: 140
diff changeset
    41
#ifdef HAVE_IDN
d24c4392d4e3 2006-06-16 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents: 140
diff changeset
    42
#include <stringprep.h>
d24c4392d4e3 2006-06-16 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents: 140
diff changeset
    43
#include <punycode.h>
d24c4392d4e3 2006-06-16 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents: 140
diff changeset
    44
#include <idna.h>
d24c4392d4e3 2006-06-16 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents: 140
diff changeset
    45
#endif
d24c4392d4e3 2006-06-16 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents: 140
diff changeset
    46
1
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    47
#include "lm-internals.h"
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    48
#include "lm-utils.h"
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    49
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    50
LmCallback *
607
e2bd14357c9a Some style fixes
Frank Zschockelt <lm@freakysoft.de>
parents: 533
diff changeset
    51
_lm_utils_new_callback (gpointer       func,
533
c45243823756 Added some TODO items and minor style fixes
Mikael Hallendal <micke@imendio.com>
parents: 518
diff changeset
    52
                        gpointer       user_data,
518
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    53
                        GDestroyNotify notify)
1
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    54
{
518
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    55
    LmCallback *cb;
607
e2bd14357c9a Some style fixes
Frank Zschockelt <lm@freakysoft.de>
parents: 533
diff changeset
    56
518
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    57
    cb = g_new0 (LmCallback, 1);
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    58
    cb->func = func;
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    59
    cb->user_data = user_data;
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    60
    cb->notify = notify;
1
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    61
518
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    62
    return cb;
1
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    63
}
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    64
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    65
void
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    66
_lm_utils_free_callback (LmCallback *cb)
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    67
{
518
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    68
    if (!cb) {
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    69
        return;
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    70
    }
64
dd835d5cee71 2004-01-06 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents: 57
diff changeset
    71
518
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    72
    if (cb->notify) {
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    73
        (* cb->notify) (cb->user_data);
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    74
    }
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    75
    g_free (cb);
1
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    76
}
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    77
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    78
gchar *
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    79
_lm_utils_generate_id (void)
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    80
{
518
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    81
    static guint  last_id = 0;
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    82
    GTimeVal      tv;
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    83
    glong         val;
1
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    84
518
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    85
    g_get_current_time (&tv);
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    86
    val = (tv.tv_sec & tv.tv_usec) + last_id++;
607
e2bd14357c9a Some style fixes
Frank Zschockelt <lm@freakysoft.de>
parents: 533
diff changeset
    87
518
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    88
    return g_strdup_printf ("%ld%ld", val, tv.tv_usec);
1
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    89
}
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
    90
155
d24c4392d4e3 2006-06-16 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents: 140
diff changeset
    91
gchar*
d24c4392d4e3 2006-06-16 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents: 140
diff changeset
    92
_lm_utils_hostname_to_punycode (const gchar *hostname)
d24c4392d4e3 2006-06-16 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents: 140
diff changeset
    93
{
d24c4392d4e3 2006-06-16 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents: 140
diff changeset
    94
#ifdef HAVE_IDN
518
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    95
    char *s;
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    96
    uint32_t *q;
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    97
    int rc;
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
    98
    gchar *result;
155
d24c4392d4e3 2006-06-16 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents: 140
diff changeset
    99
518
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
   100
    q = stringprep_utf8_to_ucs4 (hostname, -1, NULL);
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
   101
    if (q == NULL) {
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
   102
        return g_strdup (hostname);
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
   103
    }
155
d24c4392d4e3 2006-06-16 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents: 140
diff changeset
   104
518
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
   105
    rc = idna_to_ascii_4z (q, &s, IDNA_ALLOW_UNASSIGNED);
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
   106
    free(q);
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
   107
    if (rc != IDNA_SUCCESS) {
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
   108
        return g_strdup (hostname);
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
   109
    }
155
d24c4392d4e3 2006-06-16 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents: 140
diff changeset
   110
518
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
   111
    /* insures result is allocated through glib */
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
   112
    result = g_strdup(s);
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
   113
    free(s);
155
d24c4392d4e3 2006-06-16 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents: 140
diff changeset
   114
518
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
   115
    return result;
155
d24c4392d4e3 2006-06-16 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents: 140
diff changeset
   116
#else
518
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
   117
    return g_strdup(hostname);
155
d24c4392d4e3 2006-06-16 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents: 140
diff changeset
   118
#endif
168
ac1affcd5d22 2006-09-01 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents: 155
diff changeset
   119
}
ac1affcd5d22 2006-09-01 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents: 155
diff changeset
   120
179
6cc952969ff1 doc work
hallski <hallski>
parents: 177
diff changeset
   121
/**
236
b4e5c1cb114e Some tweaks while trying to solve LM-52.
Mikael Hallendal <micke@imendio.com>
parents: 179
diff changeset
   122
 * lm_utils_get_localtime:
179
6cc952969ff1 doc work
hallski <hallski>
parents: 177
diff changeset
   123
 * @stamp: An XMPP timestamp
6cc952969ff1 doc work
hallski <hallski>
parents: 177
diff changeset
   124
 *
6cc952969ff1 doc work
hallski <hallski>
parents: 177
diff changeset
   125
 * Converts an XMPP timestamp to a struct tm showing local time.
607
e2bd14357c9a Some style fixes
Frank Zschockelt <lm@freakysoft.de>
parents: 533
diff changeset
   126
 *
179
6cc952969ff1 doc work
hallski <hallski>
parents: 177
diff changeset
   127
 * Return value: The local time struct.
6cc952969ff1 doc work
hallski <hallski>
parents: 177
diff changeset
   128
 **/
168
ac1affcd5d22 2006-09-01 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents: 155
diff changeset
   129
struct tm *
1
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
   130
lm_utils_get_localtime (const gchar *stamp)
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
   131
{
518
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
   132
    struct tm tm;
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
   133
    time_t    t;
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
   134
    gint      year, month;
607
e2bd14357c9a Some style fixes
Frank Zschockelt <lm@freakysoft.de>
parents: 533
diff changeset
   135
518
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
   136
    g_return_val_if_fail (stamp != NULL, NULL);
168
ac1affcd5d22 2006-09-01 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents: 155
diff changeset
   137
518
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
   138
    /* 20021209T23:51:30 */
1
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
   139
607
e2bd14357c9a Some style fixes
Frank Zschockelt <lm@freakysoft.de>
parents: 533
diff changeset
   140
    sscanf (stamp, "%4d%2d%2dT%2d:%2d:%2d",
518
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
   141
            &year, &month, &tm.tm_mday, &tm.tm_hour,
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
   142
            &tm.tm_min, &tm.tm_sec);
65
e6871fda6fc9 2004-01-08 Richard Hult <richard@imendio.com>
rhult <rhult>
parents: 64
diff changeset
   143
518
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
   144
    tm.tm_year = year - 1900;
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
   145
    tm.tm_mon = month - 1;
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
   146
    tm.tm_isdst = -1;
65
e6871fda6fc9 2004-01-08 Richard Hult <richard@imendio.com>
rhult <rhult>
parents: 64
diff changeset
   147
518
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
   148
    t = mktime (&tm);
1
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
   149
65
e6871fda6fc9 2004-01-08 Richard Hult <richard@imendio.com>
rhult <rhult>
parents: 64
diff changeset
   150
#if defined(HAVE_TM_GMTOFF)
518
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
   151
    t += tm.tm_gmtoff;
65
e6871fda6fc9 2004-01-08 Richard Hult <richard@imendio.com>
rhult <rhult>
parents: 64
diff changeset
   152
#elif defined(HAVE_TIMEZONE)
518
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
   153
    t -= timezone;
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
   154
    if (tm.tm_isdst > 0) {
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
   155
        t += 3600;
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
   156
    }
607
e2bd14357c9a Some style fixes
Frank Zschockelt <lm@freakysoft.de>
parents: 533
diff changeset
   157
#endif
1
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
   158
518
cdd6a0c5b439 Went over all of the files and made sure they all were indented the same way.
Mikael Hallendal <micke@imendio.com>
parents: 516
diff changeset
   159
    return localtime (&t);
1
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
   160
}
50e230cf7818 Initial revision
hallski <hallski>
parents:
diff changeset
   161
155
d24c4392d4e3 2006-06-16 Mikael Hallendal <micke@imendio.com>
hallski <hallski>
parents: 140
diff changeset
   162