87 #define RAST_MISC "cell_misc"
141 while (fgets(buf,
sizeof(buf), fd)) {
142 if (sscanf(buf,
"%1s", comment) != 1 || *comment ==
'#')
166 fprintf(fd,
"%s\n", buf);
185 char temp1[128], temp2[128];
198 else if (ts->
count == 2)
199 sprintf(buf,
"%s / %s", temp1, temp2);
224 for (slash = buf; *slash; slash++)
286 static int write_timestamp(
const char *maptype,
const char *dir,
294 G_warning(
_(
"Unable to create timestamp file for %s map <%s@%s>"),
303 G_warning(
_(
"Invalid timestamp specified for %s map <%s@%s>"), maptype,
322 static int read_timestamp(
const char *maptype,
const char *dir,
323 const char *
name,
const char *mapset,
333 G_warning(
_(
"Unable to open timestamp file for %s map <%s@%s>"),
334 maptype,
name, mapset);
342 G_warning(
_(
"Invalid timestamp file for %s map <%s@%s>"), maptype,
name,
377 return read_timestamp(
"raster",
RAST_MISC,
name, mapset, ts);
459 const char *mapset,
struct TimeStamp *ts)
477 G_debug(1,
"Read timestamp <%s/%s>", dir, ele);
482 G_warning(
_(
"Unable to open timestamp file for vector map <%s@%s>"),
491 G_warning(
_(
"Invalid timestamp file for vector map <%s@%s>"),
name, mapset);
522 G_debug(1,
"Write timestamp <%s/%s>", dir, ele);
527 G_warning(
_(
"Unable to create timestamp file for vector map <%s@%s>"),
536 G_warning(
_(
"Invalid timestamp specified for vector map <%s@%s>"),
name,
597 return read_timestamp(
"raster3d",
GRID3,
name, mapset, ts);
613 return write_timestamp(
"raster3d",
GRID3,
name, ts);
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 datetime_format(const DateTime *dt, char *buf)
formats DateTime structure as a human-readable string returns 0 when successful and 'buf' is filled w...
void datetime_copy(DateTime *src, const DateTime *dst)
Copies the DateTime [into/from ???] src.
FILE * G_fopen_old(const char *, const char *, const char *)
Open a database file for reading.
FILE * G_fopen_old_misc(const char *, const char *, const char *, const char *)
open a database misc file for reading
void G_warning(const char *,...) __attribute__((format(printf
char * G_file_name(char *, const char *, const char *, const char *)
Builds full path names to GIS data files.
FILE * G_fopen_new_misc(const char *, const char *, const char *)
open a new database misc file
const char * G_mapset(void)
Get current mapset name.
int G_remove(const char *, const char *)
Remove a database file.
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)
int G_remove_misc(const char *, const char *, const char *)
Remove a database misc file.
int G_debug(int, const char *,...) __attribute__((format(printf
FILE * G_fopen_new(const char *, const char *)
Open a new database file.
#define GV_DIRECTORY
Name of vector directory.
#define GV_TIMESTAMP_ELEMENT
Name of the timestamp file.
void G_init_timestamp(struct TimeStamp *ts)
Initialize timestamp structure.
int G_read_raster_timestamp(const char *name, const char *mapset, struct TimeStamp *ts)
Read timestamp from raster map.
int G_has_raster_timestamp(const char *name, const char *mapset)
Check if timestamp for raster map exists.
int G_has_raster3d_timestamp(const char *name, const char *mapset)
Check if timestamp for 3D raster map exists.
int G_write_timestamp(FILE *fd, const struct TimeStamp *ts)
Output TimeStamp structure to a file as a formatted string.
int G_format_timestamp(const struct TimeStamp *ts, char *buf)
Create text string from TimeStamp structure.
int G_read_raster3d_timestamp(const char *name, const char *mapset, struct TimeStamp *ts)
Read timestamp from 3D raster map.
int G_remove_raster3d_timestamp(const char *name)
Remove timestamp from 3D raster map.
int G__read_timestamp(FILE *fd, struct TimeStamp *ts)
Read timestamp.
void G_set_timestamp(struct TimeStamp *ts, const DateTime *dt)
Set timestamp (single)
int G_write_raster_timestamp(const char *name, const struct TimeStamp *ts)
Write timestamp of raster map.
int G_scan_timestamp(struct TimeStamp *ts, const char *buf)
Fill a TimeStamp structure from a datetime string.
void G_set_timestamp_range(struct TimeStamp *ts, const DateTime *dt1, const DateTime *dt2)
Set timestamp (range)
int G_has_vector_timestamp(const char *name, const char *layer, const char *mapset)
Check if timestamp for vector map exists.
int G_read_vector_timestamp(const char *name, const char *layer, const char *mapset, struct TimeStamp *ts)
Read timestamp from vector map.
int G_write_raster3d_timestamp(const char *name, const struct TimeStamp *ts)
Write timestamp of 3D raster map.
int G_write_vector_timestamp(const char *name, const char *layer, const struct TimeStamp *ts)
Write timestamp of vector map.
int G_remove_vector_timestamp(const char *name, const char *layer)
Remove timestamp from vector map.
void G_get_timestamps(const struct TimeStamp *ts, DateTime *dt1, DateTime *dt2, int *count)
Copy TimeStamp into [two] Datetimes structs.
int G_remove_raster_timestamp(const char *name)
Remove timestamp from raster map.