Beispiel #1
0
void	MTime::UTCToTzSpecificLocal(int tzh)
{

	TIME_ZONE_INFORMATION tzInfo;

	if (IsLocal()) LocalToUTC();
	memset(&tzInfo, 0, sizeof(TIME_ZONE_INFORMATION));

	if (tzh > 24) tzh = 24;
	if (tzh < -24)tzh = -24;

	GetTimeZoneInformation(&tzInfo);
	tzInfo.Bias = tzh * 30i64;
	UTCToTzSpecificLocal(&tzInfo);
}
Beispiel #2
0
int MoonPhase(int date, int time)
{
    int utcd, utct;
    int y, m, d;
    double jd, mp;

    /* Convert from local to UTC */
    LocalToUTC(date, time, &utcd, &utct);

    /* Convert from Remind representation to year/mon/day */
    FromJulian(utcd, &y, &m, &d);

    /* Convert to a true Julian date -- sorry for the name clashes! */
    jd = jtime(y, m, d, (utct / 60), (utct % 60), 0);   

    /* Calculate moon phase */
    mp = 360.0 * phase(jd, NULL, NULL, NULL, NULL, NULL, NULL);
    return (int) mp;
}
Beispiel #3
0
void HuntPhase(int startdate, int starttim, int phas, int *date, int *time)
{
    int utcd, utct;
    int y, m, d;
    int h, min, s;
    int d1, t1;
    double k1, k2, jd, jdorig;
    double nt1, nt2;

    /* Convert from local to UTC */
    LocalToUTC(startdate, starttim, &utcd, &utct);

    /* Convert from Remind representation to year/mon/day */
    FromJulian(utcd, &y, &m, &d);
    /* Convert to a true Julian date -- sorry for the name clashes! */
    jdorig = jtime(y, m, d, (utct / 60), (utct % 60), 0);   
    jd = jdorig - 45.0;
    nt1 = meanphase(jd, 0.0, &k1);
    while(1) {
	jd += synmonth;
	nt2 = meanphase(jd, 0.0, &k2);
	if (nt1 <= jdorig && nt2 > jdorig) break;
	nt1 = nt2;
	k1 = k2;
    }
    jd = truephase(k1, phas/4.0);
    if (jd < jdorig) jd = truephase(k2, phas/4.0);

    /* Convert back to Remind format */
    jyear(jd, &y, &m, &d);
    jhms(jd, &h, &min, &s);

    d1 = Julian(y, m, d);
    t1 = h*60 + min;
    UTCToLocal(d1, t1, date, time);
}