git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@2751
ffa7fe5e-494d-0410-b361-
a75ebd5db220
struct attr iso8601_attr,geo_attr,layout_attr;
double trise,tset,trise_actual;
struct layout *l;
struct attr iso8601_attr,geo_attr,layout_attr;
double trise,tset,trise_actual;
struct layout *l;
if (navit_get_attr(n,attr_layout,&layout_attr,NULL)!=1) {
return; //No layout - nothing to switch
if (navit_get_attr(n,attr_layout,&layout_attr,NULL)!=1) {
return; //No layout - nothing to switch
//We've have to wait a little
return;
}
//We've have to wait a little
return;
}
+ if (sscanf(iso8601_attr.u.str,"%d-%02d-%02dT",&year,&month,&day) != 3)
+ return;
if (vehicle_get_attr(n->vehicle->vehicle, attr_position_coord_geo,&geo_attr,NULL)!=1) {
//No position - no sun
return;
if (vehicle_get_attr(n->vehicle->vehicle, attr_position_coord_geo,&geo_attr,NULL)!=1) {
//No position - no sun
return;
}
//We calculate sunrise anyway, cause it is need both for day and for night
}
//We calculate sunrise anyway, cause it is need both for day and for night
- if (__sunriset__(currTs,geo_attr.u.coord_geo->lat,geo_attr.u.coord_geo->lng,35,1,&trise,&tset)!=0) {
+ if (__sunriset__(year,month,day,geo_attr.u.coord_geo->lat,geo_attr.u.coord_geo->lng,35,1,&trise,&tset)!=0) {
//near the pole sun never rises/sets, so we should never switch profiles
n->prevTs=currTs;
return;
//near the pole sun never rises/sets, so we should never switch profiles
n->prevTs=currTs;
return;
- if (__sunriset__(currTs,geo_attr.u.coord_geo->lat,geo_attr.u.coord_geo->lng,-12,0,&trise,&tset)!=0) {
+ if (__sunriset__(year,month,day,geo_attr.u.coord_geo->lat,geo_attr.u.coord_geo->lng,-12,0,&trise,&tset)!=0) {
//near the pole sun never rises/sets, so we should never switch profiles
n->prevTs=currTs;
return;
//near the pole sun never rises/sets, so we should never switch profiles
n->prevTs=currTs;
return;
#define HOURS(h) ((int)(floor(h)))
#define MINUTES(h) ((int)(60*(h-floor(h))))
#define HOURS(h) ((int)(floor(h)))
#define MINUTES(h) ((int)(60*(h-floor(h))))
-#define ABS(x) ((x)<0?-(x):(x))
+#define ABS(x) ((x)<0?-(x):(x))
/* A macro to compute the number of days elapsed since 2000 Jan 0.0 */
/* (which is equal to 1999 Dec 31, 0h UT) */
/* A macro to compute the number of days elapsed since 2000 Jan 0.0 */
/* (which is equal to 1999 Dec 31, 0h UT) */
double __daylen__( int year, int month, int day, double lon, double lat,
double altit, int upper_limb );
double __daylen__( int year, int month, int day, double lon, double lat,
double altit, int upper_limb );
-int __sunriset__( time_t ts, double lon, double lat,
+int __sunriset__( int year, int month, int day, double lon, double lat,
double altit, int upper_limb, double *rise, double *set );
void sunpos( double d, double *lon, double *r );
double altit, int upper_limb, double *rise, double *set );
void sunpos( double d, double *lon, double *r );