Example #1
0
File: moon.c Project: Yomin/remind
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);
}
Example #2
0
void	MTime::FromStampAsLocal(const DWORD dwTimeStamp)
{
	FromStampAsUTC(dwTimeStamp);
	UTCToLocal();
}
Example #3
0
unsigned __int64 ModelUtils::CTimeConverter::CurrentLocalTime()
{
	return UTCToLocal(CurrentUTC());
}