#!/usr/bin/perl # +-======-+ # Copyright (c) 2003-2007 United States Government as represented by # the Admistrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # THIS OPEN SOURCE AGREEMENT ("AGREEMENT") DEFINES THE RIGHTS OF USE, # REPRODUCTION, DISTRIBUTION, MODIFICATION AND REDISTRIBUTION OF CERTAIN # COMPUTER SOFTWARE ORIGINALLY RELEASED BY THE UNITED STATES GOVERNMENT AS # REPRESENTED BY THE GOVERNMENT AGENCY LISTED BELOW ("GOVERNMENT AGENCY"). # THE UNITED STATES GOVERNMENT, AS REPRESENTED BY GOVERNMENT AGENCY, IS AN # INTENDED THIRD-PARTY BENEFICIARY OF ALL SUBSEQUENT DISTRIBUTIONS OR # REDISTRIBUTIONS OF THE SUBJECT SOFTWARE. ANYONE WHO USES, REPRODUCES, # DISTRIBUTES, MODIFIES OR REDISTRIBUTES THE SUBJECT SOFTWARE, AS DEFINED # HEREIN, OR ANY PART THEREOF, IS, BY THAT ACTION, ACCEPTING IN FULL THE # RESPONSIBILITIES AND OBLIGATIONS CONTAINED IN THIS AGREEMENT. # # Government Agency: National Aeronautics and Space Administration # Government Agency Original Software Designation: GSC-15354-1 # Government Agency Original Software Title: GEOS-5 GCM Modeling Software # User Registration Requested. Please Visit http://opensource.gsfc.nasa.gov # Government Agency Point of Contact for Original Software: # Dale Hithon, SRA Assistant, (301) 286-2691 # # +-======-+ BEGIN { if ( $#ARGV >= 0 ) { print STDERR <<'ENDOFHELP'; Usage: now now returns a unique 14-digit numeric string in the form of YYYYMMDDHHmmss based on the current date and time after a random-length sleep. It creates a lockfile in \$ENV{HOME} to prevent two 'now' processes from running simultaneously and sleeps a random number of seconds before retrying if a lock encountered ENDOFHELP $die_away = 1; } use FindBin; # This module contains the dirname() subroutine. use File::Basename; # If default GEOS DAS path, set path to parent directory of directory where this # script resides. $GEOSDAS_PATH = dirname( $FindBin::Bin ); # Set name of the bin directory to search for other programs needed by this one. $BIN_DIR = "$GEOSDAS_PATH/bin"; # Get the name of the directory where this script resides. If it is different # than BIN_DIR, then this directory will also be included in the list of # directories to search for modules and programs. $PROGRAM_PATH = $FindBin::Bin; # Now allow use of any modules in the bin directory, and (if not the same) the # directory where this program resides. (The search order is set so that # the program's directory is searched first, then the bin directory.) if ( $PROGRAM_PATH ne $BIN_DIR ) { @SEARCH_PATH = ( $PROGRAM_PATH, $BIN_DIR ); } else { @SEARCH_PATH = ( $BIN_DIR ); } } # End BEGIN # Any reason to exit found during the BEGIN block? if ( $die_away == 1 ) { exit 1; } # Include the directories to be searched for required modules. use lib ( @SEARCH_PATH ); # Set the path to be searched for required programs. $ENV{'PATH'} = join( ':', @SEARCH_PATH, $ENV{'PATH'} ); # This module contains the rget() subroutine. use Manipulate_time; $now = now(); print "$now\n"; # Change the return code so that 0 indicates success. (Scripts and script wrappers # return 0 on success, (unix convention), perl subroutines return "true" on success.) exit ! $rget_retcode;