Routines (alphabetical) > Routines: H > HDF-EOS Routines > EOS_SW_DEFTIMEPERIOD

# EOS_SW_DEFTIMEPERIOD

This function defines a time period for a swath. It returns a swath period ID which is used by the EOS_SW_EXTRACTPERIOD function to read all the entries of a data field within the time period. A cross track is within a time period if its midpoint is within the time period box (0), or either of its endpoints is within the time period box (1), or any point of the cross track is within the time period box (2), depending on the inclusion mode designated by the user. All elements within an included cross track are considered to be within the time period even though a particular element of the cross track might be outside the time period. The swath structure must have the Time field defined.

## Examples

In this example, we define a time period with a start time of 35232487.2 and a stop time of 36609898.1.We will consider a cross track to be within the time period if either one of the time values at the endpoints of a cross track are within the time period:

starttime = 35232487.2d

stoptime = 36609898.1d

periodID = EOS_SW_DEFTIMEPERIOD(swathID, starttime, stoptime, 1)

## Syntax

Result = EOS_SW_DEFTIMEPERIOD(swathID, starttime , stoptime, mode)

## Return Value

Returns the swath period ID if successful and FAIL (–1) otherwise.

## Arguments

### swathID

Swath id (long) returned by EOS_SW_CREATE or EOS_SW_ATTACH.

### starttime

Start time (double) of period.

### stoptime

Stop time (double) of period.

### mode

Cross Track inclusion mode (long). Allowable values are:

- 0 = Midpoint
- 1 = Endpoint
- 2 = Anypoint

## Keywords

None

## Version History

5.2 | Introduced