Coyote Graphics Routines

Date: Fri Mar 27 12:14:20 2015

single page | use frames     summary     class     fields     routine details     file attributes

.\

cgtimestamp.pro


top cgTimeStamp

Utilities

result = cgTimeStamp( [format] [, /No_Prefix] [, Random_Digits=integer] [, /UTC] [, /Valid])

This is a utility program to obtain a time stamp string suitable for using in a filename or some other string.

Return value

A string variable containing the time stamp is returned from the function.

Parameters

format in optional type=integer default=0

An integer value that selects the time stamp format. Default is 0. Possible values are:

0: _sun_feb_07_10:56:37_2010 1: _Sun_Feb_07_10:56:37_2010 2: _07_02_2010_10:56:37 3: _07022010_10:56:37 4: _07022010 5: _07Feb2010_10:56:37 6: _07feb2010_10:56:37 7: _07FEB2010_10:56:37 8: _02_07_2010_10:56:37 9: _02072010_10:56:37 10: _02072010 11: _20100207@10:56:37

Keywords

No_Prefix in optional type=boolean default=0

Set this keyword to remove the underscore prefix normally present at the start of the time stamp.

Random_Digits in optional type=integer

Set this keyword to the number of random digits you would like to append to the time stamp.

UTC in optional type=boolean default=0

Set this keyword to use UTC time in the time stamp, rather than the local time.

Valid in optional type=boolean default=0

If this keyword is set, the time stamp is passed through the IDL program IDL_VALIDNAME, and all characters that are not allowed in IDL variable names are replaced by ones that are allowed. In other words, a character like ":", which is not allowed, is turned into the character "_", which is allowed.

Examples

Here is how to use this program:

IDL> filename = 'mydatafile' + cgTimeStamp() + '.dat'

Author information

Author:

FANNING SOFTWARE CONSULTING:

David W. Fanning 1645 Sheely Drive Fort Collins, CO 80526 USA Phone: 970-221-0438 E-mail: david@idlcoyote.com Coyote's Guide to IDL Programming: http://www.idlcoyote.com

Copyright:

Copyright (c) 2010-2013, Fanning Software Consulting, Inc.

History:

Change History:

Written by David W. Fanning, 7 February 2010. Added format number 11: YYYYMMDD@HH:MM:SS so that when files are created they will list in descending time order. Matt Savoie suggestion. DWF. 10 Sept 2010. Added NO_PREFIX keyword that, if set, will prevent an underscore character from being added to the time stamp. 10 Sept 2010. DWF. Discovered that Windows and UNIX computers report the UTC time differently, resulting in the day string being a one digit integer on UNIX and a two digit integer on Windows. Fixed so the day string is always forced to be two digits. 8 October 2010. Renamed from TimeStamp to cgTimeStamp to avoid conflict with IDL's own TimeStamp function introduced in IDL 8.2.2. 6 February 2013. DWF.

File attributes

Modification date: Fri Mar 27 11:07:39 2015
Lines: 168
Docformat: rst rst