85 #define RAST_MISC "cell_misc" 139 while (fgets(buf,
sizeof(buf), fd)) {
140 if (sscanf(buf,
"%1s", comment) != 1 || *comment ==
'#')
164 fprintf(fd,
"%s\n", buf);
183 char temp1[128], temp2[128];
196 else if (ts->
count == 2)
197 sprintf(buf,
"%s / %s", temp1, temp2);
222 for (slash = buf; *slash; slash++)
284 static int write_timestamp(
const char *maptype,
const char *dir,
292 G_warning(
_(
"Unable to create timestamp file for %s map <%s@%s>"),
301 G_warning(
_(
"Invalid timestamp specified for %s map <%s@%s>"),
320 static int read_timestamp(
const char *maptype,
const char *dir,
321 const char *
name,
const char *mapset,
331 G_warning(
_(
"Unable to open timestamp file for %s map <%s@%s>"),
332 maptype,
name, mapset);
340 G_warning(
_(
"Invalid timestamp file for %s map <%s@%s>"),
341 maptype,
name, mapset);
375 return read_timestamp(
"raster",
RAST_MISC, name, mapset, ts);
391 return write_timestamp(
"raster",
RAST_MISC, name, ts);
434 G_debug(1,
"Check for timestamp <%s>", path);
436 if (access(path,
R_OK) != 0)
456 const char *mapset,
struct TimeStamp *ts)
474 G_debug(1,
"Read timestamp <%s/%s>", dir, ele);
479 G_warning(
_(
"Unable to open timestamp file for vector map <%s@%s>"),
488 G_warning(
_(
"Invalid timestamp file for vector map <%s@%s>"),
519 G_debug(1,
"Write timestamp <%s/%s>", dir, ele);
524 G_warning(
_(
"Unable to create timestamp file for vector map <%s@%s>"),
533 G_warning(
_(
"Invalid timestamp specified for vector map <%s@%s>"),
594 return read_timestamp(
"raster3d",
GRID3, name, mapset, ts);
610 return write_timestamp(
"raster3d",
GRID3, name, ts);
char * G_file_name(char *, const char *, const char *, const char *)
Builds full path names to GIS data files.
int G_remove(const char *, const char *)
Remove a database file.
int G_read_raster_timestamp(const char *name, const char *mapset, struct TimeStamp *ts)
Read timestamp from raster map.
#define GV_DIRECTORY
Name of vector directory.
int G_write_timestamp(FILE *fd, const struct TimeStamp *ts)
Output TimeStamp structure to a file as a formatted string.
void G_set_timestamp(struct TimeStamp *ts, const DateTime *dt)
Set timestamp (single)
int G_scan_timestamp(struct TimeStamp *ts, const char *buf)
Fill a TimeStamp structure from a datetime string.
int G_write_raster3d_timestamp(const char *name, const struct TimeStamp *ts)
Write timestamp of 3D raster map.
int G_has_raster_timestamp(const char *name, const char *mapset)
Check if timestamp for raster map exists.
int G_remove_misc(const char *, const char *, const char *)
Remove a database misc file.
int G_write_raster_timestamp(const char *name, const struct TimeStamp *ts)
Write timestamp of raster map.
int G__read_timestamp(FILE *fd, struct TimeStamp *ts)
Read timestamp.
void datetime_copy(DateTime *src, const DateTime *dst)
Copies the DateTime [into/from ???] src.
FILE * G_fopen_new(const char *, const char *)
Open a new database file.
int G_remove_vector_timestamp(const char *name, const char *layer)
Remove timestamp from vector map.
FILE * G_fopen_old_misc(const char *, const char *, const char *, const char *)
open a database misc file for reading
void G_get_timestamps(const struct TimeStamp *ts, DateTime *dt1, DateTime *dt2, int *count)
Copy TimeStamp into [two] Datetimes structs.
FILE * G_fopen_old(const char *, const char *, const char *)
Open a database file for reading.
int G_has_vector_timestamp(const char *name, const char *layer, const char *mapset)
Check if timestamp for vector map exists.
int G_remove_raster3d_timestamp(const char *name)
Remove timestamp from 3D raster map.
const char * G_find_file2_misc(const char *, const char *, const char *, const char *)
Searches for a misc file from the mapset search list or in a specified mapset. (look but don't touch)...
FILE * G_fopen_new_misc(const char *, const char *, const char *)
open a new database misc file
void G_set_timestamp_range(struct TimeStamp *ts, const DateTime *dt1, const DateTime *dt2)
Set timestamp (range)
const char * G_mapset(void)
Get current mapset name.
int datetime_scan(DateTime *dt, const char *buf)
Convert the ascii string into a DateTime. This determines the mode/from/to based on the string...
int G_snprintf(char *, size_t, const char *,...) __attribute__((format(printf
void G_warning(const char *,...) __attribute__((format(printf
int G_write_vector_timestamp(const char *name, const char *layer, const struct TimeStamp *ts)
Write timestamp of vector map.
int G_read_vector_timestamp(const char *name, const char *layer, const char *mapset, struct TimeStamp *ts)
Read timestamp from vector map.
int G_remove_raster_timestamp(const char *name)
Remove timestamp from raster map.
int G_has_raster3d_timestamp(const char *name, const char *mapset)
Check if timestamp for 3D raster map exists.
#define GV_TIMESTAMP_ELEMENT
Name of the timestamp file.
int datetime_format(const DateTime *dt, char *buf)
formats DateTime structure as a human-readable string returns 0 when successful and 'buf' is filled w...
int G_format_timestamp(const struct TimeStamp *ts, char *buf)
Create text string from TimeStamp structure.
int G_debug(int, const char *,...) __attribute__((format(printf
int G_read_raster3d_timestamp(const char *name, const char *mapset, struct TimeStamp *ts)
Read timestamp from 3D raster map.
void G_init_timestamp(struct TimeStamp *ts)
Initialize timestamp structure.