367231f28b6300fed04e5e6b676ff5b6b128f859
[open-ath9k-htc-firmware.git] / target_firmware / magpie_fw_dev / build / utility / adjust_time / adj_time.c
1 #include <sys/types.h>
2 #include <sys/stat.h>
3 #include <unistd.h>
4 #include <utime.h>
5
6 #define FILE_NAME_LEN 256
7
8
9 int main(int argc, char **argv)
10 {
11     char ar_file_name[FILE_NAME_LEN], obj_file_name[FILE_NAME_LEN];
12    
13     struct stat ar_file_stat, obj_file_stat;
14    
15     struct utimbuf obj_file_utb;
16    
17     if (argc != 3)
18     {
19         printf("\nUsage: adj_time archive_file obj_file\n");            
20     }           
21     else
22     {           
23         strcpy(ar_file_name, argv[1]);
24         strcpy(obj_file_name, argv[2]);
25    
26         stat(ar_file_name, &ar_file_stat);
27         stat(obj_file_name, &obj_file_stat);
28    
29         if (ar_file_stat.st_mtime == obj_file_stat.st_mtime)
30         {
31             obj_file_utb.actime = obj_file_stat.st_atime;
32             obj_file_utb.modtime = obj_file_stat.st_mtime + 1;
33       
34             utime(obj_file_name, &obj_file_utb);
35         }
36     }       
37    
38     exit(0);
39 }