I am looking for the UTC (from RFC3339 format) to IST conversion in C program. But I could not find any generic way to convert the time.
Here, I found the shell script to convert the UTC time (in RFC3339 format) to IST and I am trying to implement in C code.
From the script, I can't find the equivalent way for the statement
newdate=$(TZ=IST date -d "$formatT UTC-5:30")
in C code.
So, I did time diff of -5:30
with the GMT time as shown in below snippet. But, it is not working as expected.
int main(int argc, char *argv[])
{
const char *utctime = "2019-07-24T11:47:33";
struct tm tm = {0};
char s[128] = {0};
if (NULL == (strptime(utctime, "%Y-%m-%dT%H:%M:%S", &tm))) {
printf("strptime failed\n");
}
printf("IST Time : %2d:%02d\n", ((tm.tm_hour-5)%24), tm.tm_min-30);
}
Kindly, guide me to do the task in C code that the script does.