~vcs-imports/balsa/master

« back to all changes in this revision

Viewing changes to libbalsa/missing_time.c

  • Committer: Pawel Salek
  • Date: 2009-02-07 22:20:25 UTC
  • Revision ID: git-v1:750bab1bc2273852311a96325e04bc194547498a
minimum gtk version upgraded, link cleanup (Incomplete!). Check min

* INSTALL: minimum gtk version upgraded, link cleanup (Incomplete!).
* configure.in: Check min versions, new option for Mac OS X desktop,
  check for *time_r funcs, remove unnecessary check for iconv
* src/filter-edit.h, src/balsa-index.c, src/balsa-mblist.c
* src/mailbox-conf.c, src/filter-edit-dialog.c, src/pref-manager.c
* src/address-book-config.c, libbalsa/misc.[hc]
* libbalsa/libbalsa-conf.[hc], libbalsa/address.c, libbalsa/identity.c
* src/filter-edit-callbacks.c: Assume we have Gtk+/glib >= 2.6.0
* libbalsa/imap/imap_search.c:
  use GDate instead of localtime_r (avoid dependency to libbalsa)
* libbalsa/rfc3156.c: use glib random func
* libbalsa/Makefile.am, libbalsa/missing{_time.c,.h}:
  add system-dependent time_r funcs
* src/main-window.c:
  Add basic Mac OS X menu integration, assume we have Gtk+/glib >= 2.6.0
* src/sendmsg-window.c: Add basic Mac OS X menu integration, use g_strdup.
* src/save-restore.[hc], libinit_balsa/assistant_page_defclient.[hc],
* libinit_balsa/assistant_init.c: No Gnome default client without Gnome
* src/toolbar-factory.c, src/main.c, src/Makefile.am:
  Build without Gnome support
* src/print-gtk.c: Mac OS X doesn't define _NL_MEASUREMENT_MEASUREMENT
* src/balsa-icons.c:  Remove unnecessary include.
* src/balsa-bonobo.[hc]: Only compiled if building with Gnome support
* src/balsa-app.c:
  Gdk on Mac OS X cannot create a new colour map, fall back to system
* src/ab-main.c:
  Build Gnome stuff only when available, assume we have Gtk+/glib >=
  2.6.0, add basic Mac OS X menu integration.

svn path=/trunk/; revision=8068

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*-mode:c; c-style:k&r; c-basic-offset:4; -*- */
 
2
/* Balsa E-Mail Client
 
3
 *
 
4
 * Copyright (C) 1997-2002 Stuart Parmenter and others,
 
5
 *                         See the file AUTHORS for a list.
 
6
 *
 
7
 * This program is free software; you can redistribute it and/or modify
 
8
 * it under the terms of the GNU General Public License as published by
 
9
 * the Free Software Foundation; either version 2, or (at your option) 
 
10
 * any later version.
 
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 General Public License
 
18
 * along with this program; if not, write to the Free Software
 
19
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  
 
20
 * 02111-1307, USA.
 
21
 */
 
22
 
 
23
#include "config.h"
 
24
 
 
25
#include <string.h>
 
26
 
 
27
#if HAVE_THREADS
 
28
#include <pthread.h>
 
29
static pthread_mutex_t time_lock = PTHREAD_MUTEX_INITIALIZER;
 
30
#define LOCK(mutex)   pthread_mutex_lock(&mutex)
 
31
#define UNLOCK(mutex) pthread_mutex_unlock(&mutex)
 
32
#else
 
33
#define LOCK(mutex)
 
34
#define UNLOCK(mutex)
 
35
#endif /* HAVE_THREADS */
 
36
 
 
37
#include "missing.h"
 
38
 
 
39
 
 
40
#ifndef HAVE_CTIME_R
 
41
char *
 
42
ctime_r(const time_t *clock, char *buf)
 
43
{
 
44
    LOCK(time_lock);
 
45
    strcpy(buf, ctime(clock));
 
46
    UNLOCK(time_lock);
 
47
    return buf;
 
48
}
 
49
#endif
 
50
 
 
51
 
 
52
#ifndef HAVE_LOCALTIME_R 
 
53
struct tm *
 
54
localtime_r(const time_t *clock, struct tm *result)
 
55
{
 
56
    LOCK(time_lock);
 
57
    memcpy(result, localtime(clock), sizeof(struct tm));
 
58
    UNLOCK(time_lock);
 
59
    return result;
 
60
}
 
61
#endif
 
62
 
 
63
 
 
64
#ifndef HAVE_GMTIME_R
 
65
struct tm *
 
66
gmtime_r(const time_t *clock, struct tm *result)
 
67
{
 
68
    LOCK(time_lock);
 
69
    memcpy(result, gmtime(clock), sizeof(struct tm));
 
70
    UNLOCK(time_lock);
 
71
    return result;
 
72
}
 
73
#endif