timestamp.c File Reference

#include <string.h>
#include <grass/gis.h>
#include <grass/glocale.h>

Include dependency graph for timestamp.c:

Go to the source code of this file.

Defines

#define RAST_MISC   "cell_misc"
#define VECT_MISC   "dig_misc"
#define GRID3   "grid3"

Functions

void G_init_timestamp (struct TimeStamp *ts)
void G_set_timestamp (struct TimeStamp *ts, DateTime *dt)
void G_set_timestamp_range (struct TimeStamp *ts, DateTime *dt1, DateTime *dt2)
int G__read_timestamp (FILE *fd, struct TimeStamp *ts)
int G__write_timestamp (FILE *fd, struct TimeStamp *ts)
 output TimeStamp structure to a file as a formatted string
int G_format_timestamp (struct TimeStamp *ts, char *buf)
 Create text string from TimeStamp structure.
int G_scan_timestamp (struct TimeStamp *ts, char *buf)
 Fill a TimeStamp structure from a datetime string.
int G_get_timestamps (struct TimeStamp *ts, DateTime *dt1, DateTime *dt2, int *count)
 copy TimeStamp into [two] Datetimes structs
int G_read_raster_timestamp (char *name, char *mapset, struct TimeStamp *ts)
 Read timestamp from raster map.
int G_remove_raster_timestamp (char *name)
 Only timestamp files in current mapset can be removed Returns: 0 if no file 1 if successful -1 on fail.
int G_read_vector_timestamp (char *name, char *mapset, struct TimeStamp *ts)
 Read vector timestamp.
int G_remove_vector_timestamp (char *name)
 Is this used anymore with the new GRASS 6 vector engine???
int G_read_grid3_timestamp (char *name, char *mapset, struct TimeStamp *ts)
 read grid3 timestamp
int G_remove_grid3_timestamp (char *name)
 remove grid3 timestamp
int G_write_raster_timestamp (char *name, struct TimeStamp *ts)
 Returns: 1 on success. -1 error - can't create timestamp file -2 error - invalid datetime in ts.
int G_write_vector_timestamp (char *name, struct TimeStamp *ts)
 Returns: 1 on success. -1 error - can't create timestamp file -2 error - invalid datetime in ts.
int G_write_grid3_timestamp (char *name, struct TimeStamp *ts)
 write grid3 timestamp


Define Documentation

#define GRID3   "grid3"

#define RAST_MISC   "cell_misc"

#define VECT_MISC   "dig_misc"


Function Documentation

int G__read_timestamp ( FILE *  fd,
struct TimeStamp *  ts 
)

Definition at line 119 of file timestamp.c.

References G_scan_timestamp().

int G__write_timestamp ( FILE *  fd,
struct TimeStamp *  ts 
)

output TimeStamp structure to a file as a formatted string

A handy fd might be "stdout".

Returns: 0 on success -1 error

Parameters:
fd file descriptor
ts TimeStamp struct
Returns:
int exit value

Definition at line 147 of file timestamp.c.

References G_format_timestamp().

int G_format_timestamp ( struct TimeStamp *  ts,
char *  buf 
)

Create text string from TimeStamp structure.

Fills string *buf with info from TimeStamp structure *ts in a pretty way. The TimeStamp struct is defined in gis.h and populated with e.g. G_read_raster_timestamp().

Returns: 1 on success -1 error

Parameters:
ts TimeStamp structure containing time info
buf string to receive formatted timestamp
Returns:
int exit value

Definition at line 173 of file timestamp.c.

Referenced by G__write_timestamp().

int G_get_timestamps ( struct TimeStamp *  ts,
DateTime *  dt1,
DateTime *  dt2,
int *  count 
)

copy TimeStamp into [two] Datetimes structs

Use to copy the TimeStamp information into Datetimes, as the members of struct TimeStamp shouldn't be accessed directly.

count=0 means no datetimes were copied count=1 means 1 datetime was copied into dt1 count=2 means 2 datetimes were copied

Parameters:
ts source TimeStamp structure
dt1 first DateTime struct to be filled
dt2 second DateTime struct to be filled
count return code
Returns:
int always 0

Definition at line 261 of file timestamp.c.

void G_init_timestamp ( struct TimeStamp *  ts  ) 

Definition at line 99 of file timestamp.c.

Referenced by G_scan_timestamp().

int G_read_grid3_timestamp ( char *  name,
char *  mapset,
struct TimeStamp *  ts 
)

read grid3 timestamp

Returns 1 on success. 0 or negative on error.

Parameters:
name 
mapset 
ts 
Returns:
int

Definition at line 456 of file timestamp.c.

References GRID3.

int G_read_raster_timestamp ( char *  name,
char *  mapset,
struct TimeStamp *  ts 
)

Read timestamp from raster map.

Returns: 1 on success 0 or negative on error.

Parameters:
name map name
mapset mapset the map lives in
ts TimeStamp struct to populate
Returns:
int

Definition at line 365 of file timestamp.c.

References RAST_MISC.

int G_read_vector_timestamp ( char *  name,
char *  mapset,
struct TimeStamp *  ts 
)

Read vector timestamp.

Is this used anymore with the new GRASS 6 vector engine???

Returns 1 on success. 0 or negative on error.

Parameters:
name 
mapset 
ts 
Returns:
int

Definition at line 410 of file timestamp.c.

References VECT_MISC.

int G_remove_grid3_timestamp ( char *  name  ) 

remove grid3 timestamp

Only timestamp files in current mapset can be removed Returns: 0 if no file 1 if successful -1 on fail

Parameters:
name 
Returns:
int

Definition at line 479 of file timestamp.c.

References G_remove(), and GRID3.

int G_remove_raster_timestamp ( char *  name  ) 

Only timestamp files in current mapset can be removed Returns: 0 if no file 1 if successful -1 on fail.

Parameters:
name 
Returns:
int

Definition at line 388 of file timestamp.c.

References G_remove(), and RAST_MISC.

int G_remove_vector_timestamp ( char *  name  ) 

Is this used anymore with the new GRASS 6 vector engine???

Only timestamp files in current mapset can be removed Returns: 0 if no file 1 if successful -1 on fail

Parameters:
name 
Returns:
int

Definition at line 436 of file timestamp.c.

References G_remove(), and VECT_MISC.

int G_scan_timestamp ( struct TimeStamp *  ts,
char *  buf 
)

Fill a TimeStamp structure from a datetime string.

Populate a TimeStamp structure (defined in gis.h) from a text string. Checks to make sure text string is in valid GRASS datetime format.

Returns: 1 on success -1 error

Parameters:
ts TimeStamp structure to be populated
buf String containing formatted time info
Returns:
int exit code

Definition at line 212 of file timestamp.c.

References G_init_timestamp(), G_set_timestamp(), and G_set_timestamp_range().

Referenced by G__read_timestamp().

void G_set_timestamp ( struct TimeStamp *  ts,
DateTime *  dt 
)

Definition at line 104 of file timestamp.c.

Referenced by G_scan_timestamp().

void G_set_timestamp_range ( struct TimeStamp *  ts,
DateTime *  dt1,
DateTime *  dt2 
)

Definition at line 110 of file timestamp.c.

Referenced by G_scan_timestamp().

int G_write_grid3_timestamp ( char *  name,
struct TimeStamp *  ts 
)

write grid3 timestamp

Returns: 1 on success. -1 error - can't create timestamp file -2 error - invalid datetime in ts

Parameters:
name 
ts 
Returns:
int

Definition at line 548 of file timestamp.c.

References GRID3.

int G_write_raster_timestamp ( char *  name,
struct TimeStamp *  ts 
)

Returns: 1 on success. -1 error - can't create timestamp file -2 error - invalid datetime in ts.

Parameters:
name 
ts 
Returns:
int

Definition at line 501 of file timestamp.c.

References RAST_MISC.

int G_write_vector_timestamp ( char *  name,
struct TimeStamp *  ts 
)

Returns: 1 on success. -1 error - can't create timestamp file -2 error - invalid datetime in ts.

Parameters:
name 
ts 
Returns:
int

Definition at line 525 of file timestamp.c.

References VECT_MISC.


Generated on Sun Apr 6 17:32:26 2008 for GRASS by  doxygen 1.5.5