3 /* time - time related syscal wrappers */
5 /* Copyright (c) 2003-2007 Martin Quinson. All rights reserved. */
7 /* This program is free software; you can redistribute it and/or modify it
8 * under the terms of the license (GNU LGPL) which comes with this package. */
10 #include "gras/Virtu/virtu_sg.h"
13 * Time elapsed since the begining of the simulation.
16 return SIMIX_get_clock();
20 * Freeze the process for the specified amount of time
22 void xbt_sleep(double sec) {
23 smx_action_t act_sleep;
24 smx_process_t proc = SIMIX_process_self();
27 /* create action to sleep */
28 act_sleep = SIMIX_action_sleep(SIMIX_process_get_host(proc),sec);
30 mutex = SIMIX_mutex_init();
31 SIMIX_mutex_lock(mutex);
32 /* create conditional and register action to it */
33 cond = SIMIX_cond_init();
35 SIMIX_register_action_to_condition(act_sleep, cond);
36 SIMIX_cond_wait(cond,mutex);
37 SIMIX_mutex_unlock(mutex);
39 /* remove variables */
40 SIMIX_cond_destroy(cond);
41 SIMIX_mutex_destroy(mutex);
42 SIMIX_action_destroy(act_sleep);