#!/usr/bin/env bash
############################################################################
# This shell processes usleep commands as required by the test scripts
# on systems lacking the usleep command (e.g. AIX). It does not
# interpret all usleep options, only those required for these tests.
############################################################################
# Copyright (C) 2002 The Regents of the University of California.
# Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
# Written by Morris Jette <jette1@llnl.gov>
# CODE-OCEC-09-009. All rights reserved.
#
# This file is part of SLURM, a resource management program.
# For details, see <http://www.schedmd.com/slurmdocs/>.
 # Please also read the supplied file: DISCLAIMER.
#
# SLURM is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# SLURM is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along
# with SLURM; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
############################################################################
#
# Read command line options
if [ $# -ge 1 ]; then
	usec=$1
	sec=$(($usec/1000000))
else
	usec=1
	sec=1
fi
# Validate command line options
if [ $sec -lt 1 ]; then
	sec=1
fi
# Find the appropriate processes and signal them
sleep $sec
