Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Xiph.Org
Icecast-Server
Commits
fbd92a91
Commit
fbd92a91
authored
Jan 26, 2004
by
Karl Heyes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add localtime_r checks, useful the threads
svn path=/trunk/icecast/; revision=5785
parent
48abfaa9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
1 deletion
+26
-1
configure.in
configure.in
+1
-1
src/util.c
src/util.c
+20
-0
src/util.h
src/util.h
+5
-0
No files found.
configure.in
View file @
fbd92a91
...
...
@@ -62,7 +62,7 @@ dnl Checks for typedefs, structures, and compiler characteristics.
dnl Check for types
dnl Checks for library functions.
AC_CHECK_FUNCS(nanosleep poll)
AC_CHECK_FUNCS(
localtime_r
nanosleep poll)
XIPH_NET
dnl -- configure options --
...
...
src/util.c
View file @
fbd92a91
...
...
@@ -24,6 +24,7 @@
#endif
#include "net/sock.h"
#include "thread/thread.h"
#include "cfgfile.h"
#include "util.h"
...
...
@@ -587,3 +588,22 @@ char *util_dict_urlencode(util_dict *dict, char delim)
return
res
;
}
#ifndef HAVE_LOCALTIME_R
struct
tm
*
localtime_r
(
const
time_t
*
timep
,
struct
tm
*
result
)
{
static
mutex_t
localtime_lock
;
static
int
initialised
=
0
;
struct
tm
*
tm
;
if
(
initialised
==
0
)
{
thread_mutex_create
(
&
localtime_lock
);
initialised
=
1
;
}
thread_mutex_lock
(
&
localtime_lock
);
tm
=
localtime
(
timep
);
memcpy
(
result
,
tm
,
sizeof
(
*
result
));
thread_mutex_unlock
(
&
localtime_lock
);
return
result
;
}
#endif
src/util.h
View file @
fbd92a91
...
...
@@ -32,4 +32,9 @@ void util_dict_free(util_dict *dict);
int
util_dict_set
(
util_dict
*
dict
,
const
char
*
key
,
const
char
*
val
);
const
char
*
util_dict_get
(
util_dict
*
dict
,
const
char
*
key
);
char
*
util_dict_urlencode
(
util_dict
*
dict
,
char
delim
);
#ifndef HAVE_LOCALTIME_R
struct
tm
*
localtime_r
(
const
time_t
*
timep
,
struct
tm
*
result
);
#endif
#endif
/* __UTIL_H__ */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment