blob: 607f1a9b4944cf3c93af047c70ea3037afddffe4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "jalali.h"
#include "jtime.h"
int main(int argc, char** argv) {
if (argc != 2) {
printf("wrong arguments given\n");
printf("usage jstrftime FORMAT\n");
exit(1);
}
const char* fmt = argv[1];
char buf[32];
time_t t;
size_t s;
time(&t);
struct jtm j;
jlocaltime_r(&t, &j);
jalali_show_time(&j);
s = jstrftime(buf, 32, fmt, &j);
printf("%s:%d\n", buf, (int)s);
exit(0);
}
|