Files
amiga-tz/example/date1.c
Carsten Larsen 4bc6d81ba6 Release 4 changes
2016-10-25 21:07:56 +00:00

33 lines
793 B
C

//--------------------------------------------------------------------------//
// This file is in the public domain. //
//--------------------------------------------------------------------------//
#include <stdio.h>
#include <proto/exec.h>
#include "clib/timezone.h"
#include "inline/timezone.h"
struct Library *TimezoneBase;
int main()
{
time_t rawtime;
struct tm *info;
struct tm tmp;
char buffer[80];
TimezoneBase = OpenLibrary("timezone.library", 3L);
if (!TimezoneBase) {
printf("Cannot open timezone library.\n");
return 5;
}
time(&rawtime);
info = localtime_r(&rawtime,&tmp);
strftime(buffer,80,"%+", info);
printf("%s\n", buffer);
CloseLibrary(TimezoneBase);
return 0;
}