Commit ba104fffd79f20314f6c4b3c70b5ff72494bdb79
1 parent
b90099f7
Exists in
master
and in
1 other branch
Fix
Showing
4 changed files
with
29 additions
and
17 deletions
Show diff stats
src/DATA/TOOLS/GetModificationDate.c
... | ... | @@ -3,8 +3,8 @@ |
3 | 3 | * @brief Stand-alone executable <br> Returns modification date for given VI in DDBase <br> |
4 | 4 | * |
5 | 5 | * @details GetModificationDate(string *) <br> |
6 | -* @arg \c argv[1] Full name of *_times.nc | |
7 | -* | |
6 | +* @arg \c argv[1] Path to VI directory | |
7 | +* @arg \c argv[2] Times file name | |
8 | 8 | */ |
9 | 9 | |
10 | 10 | |
... | ... | @@ -18,11 +18,6 @@ |
18 | 18 | #include <DD.h> |
19 | 19 | |
20 | 20 | |
21 | -int DataID, StartID; | |
22 | -double StartStamp; | |
23 | -char StartT[TIMELENGTH]; | |
24 | -size_t count[2] = {1L,TIMELENGTH}; | |
25 | -size_t start[2] = {0L,0L}; | |
26 | 21 | |
27 | 22 | /*---------------- NC ERROR --------------------------------------*/ |
28 | 23 | void nc_handle_error(int status) |
... | ... | @@ -36,20 +31,27 @@ int main(int argc, char *argv[]) |
36 | 31 | { |
37 | 32 | int status, len; |
38 | 33 | |
39 | - if (argc < 2){ | |
40 | - fprintf(stderr,"Usage: GetStartTime *_times.nc\n"); | |
34 | + if (argc < 3){ | |
35 | + fprintf(stderr,"Usage: GetModificationDate path_to_vi times_file_name\n"); | |
41 | 36 | exit(1); |
42 | 37 | } |
43 | 38 | |
44 | - // Open VI_times.nc | |
45 | - if ((status = nc_open(argv[1], NC_NOWRITE, &DataID)) != NC_NOERR) | |
46 | - nc_handle_error(status); | |
39 | + char timesPath[512]; | |
40 | + memset(timesPath, 0, 512*sizeof(char)); | |
41 | + strcat(timesPath, argv[1]); | |
42 | + strcat(timesPath, "/"); | |
43 | + strcat(timesPath, argv[2]); | |
44 | + | |
45 | + // Open VI_times.nc | |
46 | + int DataID; | |
47 | + if ((status = nc_open(timesPath, NC_NOWRITE, &DataID)) != NC_NOERR) | |
48 | + nc_handle_error(status); | |
47 | 49 | |
48 | 50 | char modificationDate[21]; |
49 | 51 | memset(modificationDate, 0, 21*sizeof(char)); |
50 | 52 | if ((status = nc_get_att_text(DataID, NC_GLOBAL, "ModificationDate", modificationDate)) != NC_NOERR) { |
51 | 53 | struct stat b; |
52 | - if (!stat(argv[1], &b)) { | |
54 | + if (!stat(timesPath, &b)) { | |
53 | 55 | strftime(modificationDate, 21, "%Y-%m-%dT%H:%M:%SZ", localtime( &b.st_mtime)); |
54 | 56 | } |
55 | 57 | } | ... | ... |
src/DATA/TOOLS/GetReleaseDate.c
... | ... | @@ -3,7 +3,8 @@ |
3 | 3 | * @brief Stand-alone executable <br> Returns release date for given VI in DDBase <br> |
4 | 4 | * |
5 | 5 | * @details GetReleaseDate(string *) <br> |
6 | -* @arg \c argv[1] Full name of *_times.nc | |
6 | +* @arg \c argv[1] Path to VI directory | |
7 | +* @arg \c argv[2] Times file name | |
7 | 8 | * |
8 | 9 | */ |
9 | 10 | |
... | ... | @@ -69,6 +70,7 @@ int main(int argc, char *argv[]) |
69 | 70 | time_t releaseDate = 0; |
70 | 71 | for (i = 0; i < nb_records; ++i) { |
71 | 72 | count[1] = 32; |
73 | + start[0] = i; | |
72 | 74 | if ((status = nc_get_vara_text(DataID, FileID, start, count, FileName)) != NC_NOERR) |
73 | 75 | nc_handle_error(status); |
74 | 76 | memset(filePath, 0, 512*sizeof(char)); | ... | ... |
src/DATA/TOOLS/TimesUpdate.c
... | ... | @@ -451,6 +451,14 @@ main(int argc, char **argv) |
451 | 451 | } // CASE |
452 | 452 | } // For several arguments |
453 | 453 | |
454 | + char modificationDate[21]; | |
455 | + memset(modificationDate, 0, 21*sizeof(char)); | |
456 | + | |
457 | + int modDateAttrib; | |
458 | + if ((status = nc_inq_attid(tmID, NC_GLOBAL, "ModificationDate", &modDateAttrib)) != NC_NOERR) { | |
459 | + updateModificationDate = 1; | |
460 | + } | |
461 | + | |
454 | 462 | if (updateModificationDate == 1) { |
455 | 463 | char modificationDate[21]; |
456 | 464 | memset(modificationDate, 0, 21*sizeof(char)); | ... | ... |
src/DDSERVICES/SOAP/DDserverWeb.php
... | ... | @@ -136,7 +136,7 @@ function getVIInfo($viId) |
136 | 136 | $location = $locationNode->nodeValue; |
137 | 137 | $viName = $nameNode->nodeValue; |
138 | 138 | $timesNode = $timesNode->item(0); |
139 | - $timesFile = $location.$timesNode->nodeValue; | |
139 | + $timesFile = $timesNode->nodeValue; | |
140 | 140 | |
141 | 141 | if (!empty($location) && !empty($viName)) { |
142 | 142 | |
... | ... | @@ -147,14 +147,14 @@ function getVIInfo($viId) |
147 | 147 | |
148 | 148 | // Release date |
149 | 149 | $releaseDate = NULL; |
150 | - $cmd = "/opt/tools/DDServer/bin/GetReleaseDate ".$location." ".$timesNode->nodeValue; | |
150 | + $cmd = "/opt/tools/DDServer/bin/GetReleaseDate ".$location." ".$timesFile; | |
151 | 151 | $output = array(); |
152 | 152 | exec($cmd, $output, $result_code); |
153 | 153 | if ($result_code == 0) |
154 | 154 | $releaseDate = $output[0]; |
155 | 155 | |
156 | 156 | // Modification date |
157 | - $cmd = "/opt/tools/DDServer/bin/GetModificationDate ".$timesFile; | |
157 | + $cmd = "/opt/tools/DDServer/bin/GetModificationDate ".$location." ".$timesFile; | |
158 | 158 | $output = array(); |
159 | 159 | exec($cmd, $output, $result_code); |
160 | 160 | if ($result_code == 0) | ... | ... |