gettime¤ò»È¤Ã¤¿Éÿô·×¬¤ò¤ä¤Ã¤Æ¤ß¤Þ¤·¤¿¡£
¼ã´³ÀºÅÙ¤¬Íî¤Á¤Þ¤¹¤¬¤½¤ì¤Û¤É¸·Ì©À¤ÏÍפé¤Ê¤¤¤À¤í¤¦¤È¤¤¤¦´õ˾Ū´Ñ¬¤Ç
¥ß¥êÉäÏ̵»ë¤·¤Þ¤·¤¿¡£
»þ´Ö¤À¤±¤Ê¤é¤Þ¤À¤·¤â¡¢¼Â¹ÔÃæ¤Ëǯ¤¬ÊѤï¤ë¡¦·î¤¬ÊѤï¤ë¡¦ÆüÉÕ¤ò¤Þ¤¿¤°¤Ê¤É¤¬Íí¤à¤È
µÞ·ã¤ËÌÌÅݤʽèÍý¤Ë¤Ê¤Ã¤Æ¤·¤Þ¤¦¤Î¤¬ÆñÅÀ¤Ç¤¹¤Í¡£
Æä˳Ʒî¤ÎÆü¿ô¤¬¥Ð¥é¥Ð¥é¤Ê¤Î¤¬¤Þ¤¿ÌÌÅݤʤΤȡ¢¤¦¤ë¤¦Ç¯¤¬¤¹¤´¤¯¼ÙËâ¤Ë»×¤¨¤Þ¤¹¡£
¤½¤ó¤ÊÍýͳ¤Ç¾¯¡¹Ä¹¤¯¤Ê¤Ã¤Æ¤·¤Þ¤¤¤Þ¤·¤¿¡£
dim monthdays, 13; // ³Æ·î¤ÎÆü¿ô
monthdays = 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31;
// ³«»ÏÆü»þ¤òµÏ¿
startyear = gettime(0); // ǯ
startmonth = gettime(1); // ·î
startday = gettime(3); // Æü
starthour = gettime(4); // »þ
startminute = gettime(5); // ʬ
startsecond = gettime(6); // ÉÃ
// ¤¦¤ë¤¦Ç¯¤Î³Îǧ
check_year = startyear;
gosub *check_leap;
// ³«»Ïǯ1·î1Æü¤«¤é³«»Ï·îÆü¤Þ¤Ç¤ÎÆü¿ô¡Ä¡Ä¡Ä¡Ä¡
startyeardays = 0;
repeat startmonth - 1, 1
startyeardays += monthdays(cnt);
if( cnt == 2 ) : startyeardays += leap;
loop
startyeardays += startday - 1;
// ³«»ÏÆü0»þ0ʬ0É䫤鳫»Ï»þ´Ö¤Þ¤Ç¤ÎÉÿô¡Ä¡Ä¡Ä¡Ä¤
startdayseconds = starthour*3600 + startminute*60 + startsecond;
*main
redraw 0;
color 255, 255, 255:boxf;
color 0, 0, 0:pos 0, 0;
gosub *count_time;
mes strf("³«»ÏÆü»þ\t%d/%02d/%02d %02d:%02d:%02d", startyear, startmonth, startday, starthour, startminute, startsecond);
mes strf("·×¬Æü»þ\t%d/%02d/%02d %02d:%02d:%02d", checkyear, checkmonth, checkday, checkhour, checkminute, checksecond);
mes "·Ð²áÉà = "+passseconds+"";
redraw 1;
await 17;
goto *main;
*count_time
// ·×¬Æü»þ¤òµÏ¿
checkyear = gettime(0); // ǯ
checkmonth = gettime(1); // ·î
checkday = gettime(3); // Æü
checkhour = gettime(4); // »þ
checkminute = gettime(5); // ʬ
checksecond = gettime(6); // ÉÃ
// ³«»Ïǯ1·î1Æü¤«¤é·×¬ǯ1·î1Æü¤Þ¤Ç¤ÎÆü¿ô¡Ä¡Ä¡Ä¡Ä¢
SdayfToCdayf = 0;
repeat checkyear - startyear, startyear
check_year = cnt;
gosub *check_leap;
SdayfToCdayf += 365;
SdayfToCdayf += leap;
loop
// ¤¦¤ë¤¦Ç¯¤Î³Îǧ
check_year = checkyear;
gosub *check_leap;
// ·×¬ǯ1·î1Æü¤«¤é·×¬·îÆü¤Þ¤Ç¤ÎÆü¿ô¡Ä¡Ä¡Ä¡Ä£
checkyeardays = 0;
repeat checkmonth - 1, 1
checkyeardays += monthdays(cnt);
if( cnt == 2 ) : checkyeardays += leap;
loop
checkyeardays += checkday - 1;
// ¢+£-¡ = ·Ð²áÆü¿ô
passdays = SdayfToCdayf + checkyeardays - startyeardays;
// ·Ð²áÆü¿ô¤òÉä˴¹»»¡Ä¡Ä¡Ä¡Ä¥
STCseconds = passdays * 24 * 60 * 60;
// ·×¬Æü0»þ0ʬ0É䫤é·×¬»þ´Ö¤Þ¤Ç¤ÎÉÿô¡Ä¡Ä¡Ä¡Ä¦
checkdayseconds = checkhour*3600 + checkminute*60 + checksecond;
// ¥+¦-¤ = ·Ð²áÉÿô
passseconds = STCseconds + checkdayseconds - startdayseconds;
return;
// ¤¦¤ë¤¦Ç¯¤Î³Îǧ
*check_leap
/*
¤¦¤ë¤¦Ç¯¤ÎÄêµÁ
¡¦4¤Ç³ä¤êÀÚ¤ì¤ëǯ¤Ï¤¦¤ë¤¦Ç¯
¡¦100¤Ç³ä¤êÀÚ¤ì¤ëǯ¤Ï¤¦¤ë¤¦Ç¯¤Ç¤Ï̵¤¤
¡¦400¤Ç³ä¤êÀÚ¤ì¤ëǯ¤Ï¤¦¤ë¤¦Ç¯
*/
if( (((check_year\4) == 0) && ((check_year\100) != 0)) || ((check_year\400) == 0) ) {
leap = 1;
}
else {
leap = 0;
}
return;
¤¢¤Þ¤ê¹Í¤¨¤Ê¤¯¤Æ¤â¤¤¤¤¤Ç¤¢¤í¤¦ÌäÂê¤Ç¤¹¤¬
int·¿¤ÇÉäò»»½Ð¤·¤Æ¤¤¤ë´Ø·¸¾å¡¢2038ǯÌäÂê¤ÈƱÍͤÎÍýͳ¤Ç
¹ç·×»þ´Ö¤¬Ìó68ǯ°Ê¾å¤Ë¤Ê¤ë¤È¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¤·¤Þ¤¹¡£
¹¹¤ËƱ¤¸Íýͳ¤Ç¡Ê¤Þ¤º¤¢¤ê¤¨¤Ê¤¤¤Ç¤·¤ç¤¦¤¬¡Ë
¥¢¥×¥ê¤Î³«»ÏÆü»þ¤«¤é68ǯ°Ê¾å¼Â¹Ô¤·¤Ã¤Ñ¤Ê¤·¤Ë¤¹¤ë¤È¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¤·¤Þ¤¹¡£