48 lines
1.1 KiB
C
48 lines
1.1 KiB
C
#include <stdio.h>
|
|
#include <proto/exec.h>
|
|
#include "clib/timezone.h"
|
|
#include "inline/timezone.h"
|
|
|
|
struct Library *TimezoneBase;
|
|
|
|
int main(const int argc, char *argv[])
|
|
{
|
|
time_t rawtime;
|
|
struct tm *info;
|
|
char buffer[80];
|
|
|
|
TimezoneBase = OpenLibrary("timezone.library", 3L);
|
|
if (!TimezoneBase) {
|
|
printf("Cannot open timezone library.\n");
|
|
return 5;
|
|
}
|
|
|
|
time(&rawtime);
|
|
info = localtime(&rawtime);
|
|
|
|
printf("strftime examples.\n\n");
|
|
|
|
printf("Globalized:\n");
|
|
strftime(buffer,80,"%c", info);
|
|
printf("%%c :%s\n", buffer);
|
|
strftime(buffer,80,"%x", info);
|
|
printf("%%x :%s\n", buffer);
|
|
strftime(buffer,80,"%X", info);
|
|
printf("%%X :%s\n", buffer);
|
|
strftime(buffer,80,"%+", info);
|
|
printf("%%+ :%s\n", buffer);
|
|
|
|
printf("\nLocalized:\n");
|
|
strftime_l(buffer,80,"%c", info, NULL);
|
|
printf("%%c :%s\n", buffer);
|
|
strftime_l(buffer,80,"%x", info, NULL);
|
|
printf("%%x :%s\n", buffer);
|
|
strftime_l(buffer,80,"%X", info, NULL);
|
|
printf("%%X :%s\n", buffer);
|
|
strftime_l(buffer,80,"%+", info, NULL);
|
|
printf("%%+ :%s\n", buffer);
|
|
|
|
CloseLibrary(TimezoneBase);
|
|
return 0;
|
|
}
|