26 lines
498 B
C
26 lines
498 B
C
#include "time_header.h"
|
|
|
|
timezone_t tzalloc(char const *name)
|
|
{
|
|
struct state *sp;
|
|
unsigned long memsize;
|
|
|
|
if (name == NULL || name[0] == '\0') {
|
|
return NULL;
|
|
}
|
|
|
|
memsize = sizeof(struct state);
|
|
sp = (struct state*)AllocMem(memsize, MEMF_PUBLIC | MEMF_CLEAR);
|
|
|
|
if (sp) {
|
|
int err = zoneinit(sp, name);
|
|
if (err != 0) {
|
|
FreeMem(sp, memsize);
|
|
errno = err;
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return (timezone_t)sp;
|
|
}
|