mirror of https://github.com/BOINC/boinc.git
*** empty log message ***
svn path=/trunk/boinc/; revision=421
This commit is contained in:
parent
f038a1e9bd
commit
4a7d7adf28
12
lib/util.C
12
lib/util.C
|
@ -31,18 +31,6 @@
|
||||||
#include "error_numbers.h"
|
#include "error_numbers.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
// Convert UNIX time to Julian time
|
|
||||||
//
|
|
||||||
double time_t_to_jd(time_t unix_time) {
|
|
||||||
return (((double)unix_time)/SECONDS_PER_DAY+JD0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convert Julian time to UNIX time
|
|
||||||
//
|
|
||||||
time_t jd_to_time_t(double jd) {
|
|
||||||
return ((time_t)((jd-JD0)*SECONDS_PER_DAY));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Converts a double precision time (where the value of 1 represents
|
// Converts a double precision time (where the value of 1 represents
|
||||||
// a day) into a string. smallest_timescale determines the smallest
|
// a day) into a string. smallest_timescale determines the smallest
|
||||||
// unit of time division used
|
// unit of time division used
|
||||||
|
|
11
lib/util.h
11
lib/util.h
|
@ -19,8 +19,6 @@
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
extern double time_t_to_jd(time_t unix_time);
|
|
||||||
extern time_t jd_to_time_t(double jd);
|
|
||||||
extern int double_to_ydhms (double x, int smallest_timescale, char *buf);
|
extern int double_to_ydhms (double x, int smallest_timescale, char *buf);
|
||||||
extern double dtime();
|
extern double dtime();
|
||||||
extern void boinc_sleep( int seconds );
|
extern void boinc_sleep( int seconds );
|
||||||
|
@ -33,13 +31,4 @@ extern void boinc_sleep( int seconds );
|
||||||
#define min(a,b) (((a) < (b)) ? (a) : (b))
|
#define min(a,b) (((a) < (b)) ? (a) : (b))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __MWERKS__
|
|
||||||
// Note: Although Macintosh time is based on 1/1/1904, the
|
|
||||||
//MetroWerks Standard Libraries time routines use a base of 1/1/1900.
|
|
||||||
//#define JD0 2416480.5 /* Time at 0:00 GMT 1904 Jan 1 */
|
|
||||||
#define JD0 2415020.5 /* Time at 0:00 GMT 1900 Jan 1 */
|
|
||||||
#else
|
|
||||||
#define JD0 2440587.5 /* Time at 0:00 GMT 1970 Jan 1 */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define SECONDS_PER_DAY 86400
|
#define SECONDS_PER_DAY 86400
|
||||||
|
|
Loading…
Reference in New Issue