How to specify the time zone in linux using C… here is a solution to the problem.
How to specify the time zone in linux using C
I tried to set my system’s time zone and tried using settimeofday(), which takes the time zone structure as a parameter, but only read that the structure is now obsolete ( http://linux.about.com/library/cmd/blcmdl2_settimeofday.htm) How can I go about doing this?
Thanks in advance.
EDIT: Uh, I think it’s really stupid.
I created a link.c and compiled it :
#include <stdio.h>
void main()
{
printf("This is the link \n");
}
Create a target.c and compile it:
#include <stdio.h>
void main()
{
printf("This is the target \n");
}
Then try the symbolic link function in the test program
#include <unistd.h>
void main()
{
int garbage = symlink("/home/imandhan/pythonTests/link", "/home/imandhan/pythonTests/target");
printf(garbage);
}
For some reason this gives me a segfault. Am I doing something wrong?
Solution
See >tzset(3) to set the time zone for the application.
For the entire system – send /etc/localtime
symbolic link to the appropriate file under /usr/share/zoneinfo/
.