Esempio n. 1
0
static int _sort_job_by_time_used(void *void1, void *void2)
{
	int diff;
	job_info_t *job1;
	job_info_t *job2;
	long time1, time2;

	_get_job_info_from_void(&job1, &job2, void1, void2);

	time1 = job_time_used(job1);
	time2 = job_time_used(job2);
	diff = _diff_long(time1, time2);

	if (reverse_order)
		diff = -diff;
	return diff;
}
Esempio n. 2
0
File: print.c Progetto: Cray/slurm
int _print_job_time_used(job_info_t * job, int width, bool right,
			   char* suffix)
{
	if (job == NULL)	/* Print the Header instead */
		_print_str("TIME", width, right, true);
	else
		_print_secs(job_time_used(job), width, right, false);
	if (suffix)
		printf("%s", suffix);
	return SLURM_SUCCESS;
}
Esempio n. 3
0
static int _sort_job_by_time_left(void *void1, void *void2)
{
	int diff;
	job_info_t *job1;
	job_info_t *job2;
	time_t time1, time2;

	_get_job_info_from_void(&job1, &job2, void1, void2);

	if ((job1->time_limit == INFINITE) || (job1->time_limit == NO_VAL))
		time1 = INFINITE;
	else
		time1 = job1->time_limit - job_time_used(job1);
	if ((job2->time_limit == INFINITE) || (job2->time_limit == NO_VAL))
		time2 = INFINITE;
	else
		time2 = job2->time_limit - job_time_used(job2);
	diff = _diff_time(time1, time2);

	if (reverse_order)
		diff = -diff;
	return diff;
}
Esempio n. 4
0
File: print.c Progetto: Cray/slurm
int _print_job_time_left(job_info_t * job, int width, bool right,
			  char* suffix)
{
	if (job == NULL)	/* Print the Header instead */
		_print_str("TIME_LEFT", width, right, true);
	else if (job->time_limit == INFINITE)
		_print_str("UNLIMITED", width, right, true);
	else if (job->time_limit == NO_VAL)
		_print_str("NOT_SET", width, right, true);
	else {
		time_t time_left = job->time_limit * 60 - job_time_used(job);
		_print_secs(time_left, width, right, false);
	}
	if (suffix)
		printf("%s", suffix);
	return SLURM_SUCCESS;
}