File: timezone.html

package info (click to toggle)
pythoncard 0.8.2-2
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 8,452 kB
  • sloc: python: 56,787; makefile: 56; sh: 22
file content (411 lines) | stat: -rw-r--r-- 13,534 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
<html>

	<head>
		<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
		<title>The official U.S. time - clock</title>
		<script language="javascript1.1"><!--
var ClientRecieveTime=new Date();

// BEGIN - NIST DYNAMIC DATA /////////////////////////////


var NISTSendTime = new Date( "July 22, 2001 20:00:57");
var QueryTimeZone = -7;
var QueryTimeZoneOffsetMin = -420
var QueryTimeZoneName = "Pacific";
var QueryDSTString = "Daylight Saving Time";

// END - NIST DYNAMIC DATA ////////////////////////////////////


// convert NIST time to ms
var NISTSendTimeGMTms = NISTSendTime.getTime() ;

// NIST start time in the query time zone
var QueryTimeZoneOffset = ( QueryTimeZoneOffsetMin * 60 * 1000 ) ;

// Client start time in some time zone
var ClientRecieveTimems = ClientRecieveTime.getTime() ;

// what timezone does your computer think it is? - in minutes
var ClientTimeZone = Math.floor(NISTSendTime.getTimezoneOffset()) ;

var ClientNISTDelta = Math.floor(NISTSendTimeGMTms - ClientRecieveTimems);
// -->
		</script>
		<csscriptdict>
			<script><!--
CSStopExecution = false;
CSInit = new Array;
function CSScriptInit() {
idxArray = new Array;
for(var i=0;i<CSInit.length;i++)
	idxArray[i] = i;
CSAction2(CSInit, idxArray);
}
CSAg = window.navigator.userAgent; CSBVers = parseInt(CSAg.charAt(CSAg.indexOf("/")+1),10);
function IsIE() { return CSAg.indexOf("MSIE") > 0;}
function CSIEStyl(s) { return document.all.tags("div")[s].style; }
function CSNSStyl(s) { return CSFindElement(s,0); }
function CSFindElement(n,ly) { if (CSBVers < 4) return document[n];
	var curDoc = ly ? ly.document : document; var elem = curDoc[n];
	if (!elem) { for (var i=0;i<curDoc.layers.length;i++) {
		elem = CSFindElement(n,curDoc.layers[i]); if (elem) return elem; }}
	return elem;
}
function CSButtonReturn () {
	var bAgent = window.navigator.userAgent; 
	var bAppName = window.navigator.appName;
	if ((bAppName.indexOf("Explorer") >= 0) && (bAgent.indexOf("Mozilla/3") >= 0) && (bAgent.indexOf("Mac") >= 0))
		return false; // follow link
	else return true; // follow link
}
CSIm = new Object();
function CSIShow(n,i) {
	if (document.images) {
		if (CSIm[n]) {
			var img = (!IsIE()) ? CSFindElement(n,0) : document[n];
			if (img && typeof(CSIm[n][i].src) != "undefined") {img.src = CSIm[n][i].src;}
			if(i != 0)
				self.status = CSIm[n][3];
			else
				self.status = " ";
			return true;
		}
	}
	return false;
}
function CSILoad(action) {
	im = action[1];
	if (document.images) {
		CSIm[im] = new Object();
		for (var i=2;i<5;i++) {
			if (action[i] != '') { CSIm[im][i-2] = new Image(); CSIm[im][i-2].src = action[i]; }
			else CSIm[im][i-2] = 0;
		}
		CSIm[im][3] = action[5];
	}
}
CSStopExecution = false;

function CSAction(array) { 
	return CSAction2(CSAct, array);
}
function CSAction2(fct, array) { 
	var result;
	for (var i=0;i<array.length;i++) {
		if(CSStopExecution) return false; 
		var actArray = fct[array[i]];
		var tempArray = new Array;
		for(var j=1;j<actArray.length;j++) {
			if((actArray[j] != null) && (typeof(actArray[j]) == "object") && (actArray[j].length == 2)) {
				if(actArray[j][0] == "VAR") {
					tempArray[j] = CSStateArray[actArray[j][1]];
				}
				else {
					if(actArray[j][0] == "ACT") {
						tempArray[j] = CSAction(new Array(new String(actArray[j][1])));
					}
				else
					tempArray[j] = actArray[j];
				}
			}
			else
				tempArray[j] = actArray[j];
		}			
		result = actArray[0](tempArray);
	}
	return result;
}
CSAct = new Object;

// --></script>
		</csscriptdict>
		<csactiondict>
		<script><!--
CSInit[CSInit.length] = new Array(CSILoad,/*CMP*/'change time zone',/*URL*/'images/clock/changetz4.gif',/*URL*/'images/clock/changetz3.gif',/*URL*/'','');
CSInit[CSInit.length] = new Array(CSILoad,/*CMP*/'home',/*URL*/'images/clock/clockhome1.gif',/*URL*/'images/clock/clockhome2.gif',/*URL*/'','');
CSInit[CSInit.length] = new Array(CSILoad,/*CMP*/'problems',/*URL*/'images/prob3.gif',/*URL*/'images/prob4.gif',/*URL*/'','');
// --></script>
		</csactiondict>
	</head>

 <body bgcolor="black" onload="CSScriptInit();">
  <center>
   <table border="0" cellpadding="0" cellspacing="0" frame="" width="100%" height="93%">
    <tr align="center" valign="middle">
     <td>
      <table border="0" cellpadding="0" cellspacing="0">
       <tr>
        <td></td>
        <td align="right">
        <a href="timezone.cgi?Pacific/d/-8"><img src="images/javaoffdk.gif" vspace="1" width="157" height="5" name="IsJava" border="0" alt="Switch to non-animated version of this page (without Java)"></a>
</td>
        <td></td>
       </tr>
       <tr>
        <td colspan="3" bgcolor="#ffcd38"><spacer type="block" width="1" height="1"></td>
       </tr>
       <tr>
        <td bgcolor="#ffcd38"><spacer type="block" width="1" height="1"></td>
        <td>
         <table border="0" cellpadding="0" cellspacing="0" frame="" width="480" bgcolor="#00695e"  background="images/bgndteal.gif">
          <tr>
           <td width="21" rowspan="7" valign="top" background="images/starstripe-bg.jpg"><img height="416" width="21" src="images/starstripe.jpg"></td>
           <td><img height="26" width="372" src="images/rightnow3.gif" border="0" hspace="5" vspace="5" alt="Right now, the official U.S. time is:"></td>
          </tr>
          <tr>
           <td align="center">
           
  <applet code="utcnist4.class" codebase="/" width="350" height="100" ignore>
   <param name="MINUTESOFFSET" value="-420">
   <param name="BACKGROUNDCOLOR" value="0x00695E">
   <param name="FOREGROUNDCOLOR" value="0xFFFFEE">
  </applet>
</td>
										</tr>
										<tr>
											<td align="center"><img height="3" width="438" src="images/clock/horz2line.gif" vspace="5"></td>
										</tr>
										<tr valign="middle">
											<td align="center"><font size="6">
												<table border="0" cellpadding="0" cellspacing="4" frame="">
													<tr>
														<td><a href="/" onmouseover="return CSIShow(/*CMP*/'button2',1)" onmouseout="return CSIShow(/*CMP*/'button2',0)" onclick="return CSButtonReturn()"><csobj w="74" h="39" t="Button" ht="images/clock/changetz3.gif"><a href="/" onmouseover="return CSIShow(/*CMP*/'change time zone',1)" onmouseout="return CSIShow(/*CMP*/'change time zone',0)" onclick="return CSButtonReturn()"><img src="images/clock/changetz4.gif" width="74" height="39" name="change time zone" border="0"></a></csobj></a></td>
														<td></td>
														<td align="center"><font color="#c7ee59" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular">You have chosen the <b>
															<script language="JavaScript1.2"><!--
document.write ( QueryTimeZoneName );
// -->
															</script>
															timezone</b></font><br>
															<font size="2" color="#c7ee59" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular">
															<script language="JavaScript1.2"><!--
if ( Math.floor (QueryTimeZone) < 0) 
  document.write ( ' Coordinated Universal Time ' + QueryTimeZone  + ' hours; ' );
else
  document.write ( ' Coordinated Universal Time +' + QueryTimeZone  +  ' hours; ' );

document.write (QueryDSTString + '.');


// -->
															</script>
															</font></td>
															<td></td>
							<td align="right"><csobj w="74" h="39" t="Button" ht="images/prob4.gif"><a href="about.html" onmouseover="return CSIShow(/*CMP*/'problems',1)" onmouseout="return CSIShow(/*CMP*/'problems',0)" onclick="return CSButtonReturn()"><img src="images/prob3.gif" width="74" height="39" name="problems" border="0"></a></csobj></a></td>
							   						
													</tr>
												</table>
												</font></td>
										</tr>
										<tr>
											<td align="center"><img height="3" width="438" src="images/clock/horz2line.gif" vspace="5"></td>
										</tr>
										<tr>
											<td align="center">
												<table border="0" cellpadding="0" cellspacing="0" frame="">
													<tr>
														<td width="77" align="center" valign="top"></td>
														<td width="296"><img height="160" width="300" src="images/xearths/night.jpg" name="xearth"></td>
														<td width="78" align="left" valign="bottom"><img height="120" width="46" src="images/clock/sunshine.gif" hspace="3" vspace="5"></td>
													</tr>
													<tr>
														<td width="77"></td>
														<td width="296" align="center">&nbsp;</td>
														<td width="78"></td>
													</tr>
												</table>
											</td>
										</tr>
										<tr>
											<td align="center">
												<table border="0" cellpadding="0" cellspacing="0">
													<tr>
														<td colspan="2"><img height="11" width="221" src="images/timeby.gif"></td>
													</tr>
													<tr>
														<td align="right"><a href="about.html"><img height="17" width="118" src="images/aboutsite_sm.gif" border="0"></a></td>
														<td><a href="exhibits.html"><img height="17" width="102" src="images/timeexhibits_sm.gif" border="0"></a></td>
													</tr>
												</table>
											</td>
										</tr>
									</table>
								</td>
								<td bgcolor="#ffcd38"><spacer type="block" width="1" height="1"></td>
							</tr>
							<tr>
								<td colspan="3" bgcolor="#ffcd38"><spacer type="block" width="1" height="1"></td>
							</tr>
						</table>
						<br clear="all">
						<csobj w="301" h="34" t="Button" ht="images/clock/clockhome2.gif"><a href="/" onmouseover="return CSIShow(/*CMP*/'home',1)" onmouseout="return CSIShow(/*CMP*/'home',0)" onclick="return CSButtonReturn()"><img src="images/clock/clockhome1.gif" width="301" height="34" name="home" border="0"></a></csobj></td>
				</tr>
			</table>
			<p>&nbsp;
			<script language="JavaScript1.2"><!--
updatexearthImage();

function updatexearthImage() {

  // get the computer's date
  var Thisdate = new Date();
  // convert to NIST date, using offset calculated in ClientNISTDelta
  ThisMilliseconds =  Thisdate.getTime() + ClientNISTDelta ;

  document.images['xearth'].src = xearthSrc(ThisMilliseconds);

  setTimeout("updatexearthImage()", 10000);
}

function xearthSrc(ThisMilliseconds) {

var ssue = ThisMilliseconds / 1000;
var TWOPI = 2 * Math.PI;
var EpochStart = 631065600;
var DaysSinceEpoch = (ssue - EpochStart) / (24*3600);

var RadsPerDay = TWOPI / 365.242191;

var Epsilon_g = 279.403303 * (TWOPI / 360);
var OmegaBar_g = 282.768422 * (TWOPI / 360);
var Eccentricity = 0.016713;

var MeanObliquity = 23.440592 * (TWOPI / 360);

//Compute lambda = sun_ecliptic_longitude(ssue)
//Begin sun_ecliptic_longitude
  var D = DaysSinceEpoch;
  var N = RadsPerDay * D;
  N = N % TWOPI;
  if (N < 0) N += TWOPI;

  var M_sun = N + Epsilon_g - OmegaBar_g;
  if (M_sun < 0) M_sun += TWOPI;

  //Compute var E = solve_keplers_equation(M_sun);
  //Begin solve_keplers_equation
    var E = M_sun;
    var delta;
    while (1) {
      delta = E - (Eccentricity*Math.sin(E)) - M_sun;
      if (Math.abs(delta) <= 1E-10) break;
      E -= delta / (1 - (Eccentricity*Math.cos(E)));
    }
  //End solve_keplers_equation

  var lambda = OmegaBar_g + (2 * Math.atan(Math.sqrt((1+Eccentricity) / (1-Eccentricity)) * Math.tan(E/2)));
//End sun_ecliptic_longitude


//Compute ecliptic_to_equatorial(lambda, 0.0, alpha, delta)
  var sin_e = Math.sin(MeanObliquity);
  var cos_e = Math.cos(MeanObliquity);
  var alpha = Math.atan2(Math.sin(lambda)*cos_e, Math.cos(lambda));
  var delta = Math.asin(sin_e*Math.sin(lambda));
//End ecliptic_to_equatorial

//Compute GST(ssue)
  //Compute JD = julian_date(year, month, day)
    var TmpDate = new Date(ThisMilliseconds);
	var OffsetMilliseconds = ThisMilliseconds ; //+ (60000*TmpDate.getTimezoneOffset());
    var ThisDate = new Date(OffsetMilliseconds);
    var y = ThisDate.getYear();
      if (y < 1000) y += 1900;
    var m = ThisDate.getMonth() + 1;
    var z = ThisDate.getDate();
    
//	if ((m==1) || (m==2)) {
//	  y -= 1;
//	  m += 12; }

	var A = y / 100;
	var B = 2 - A + (A/4);
	var C = 365.25 * y;
	var D = 30.6001 * (m+1);

	var JD = B + C + D + z + 1720994.5;
  //End julian_date

  var T = (JD - 2451545) / 36525;
  var T0 = ((((T + 2.5862E-5) * T) + 2400.051336) * T) + 6.697374558;

  T0 = T0 % 24;
  if (T0 < 0) T0 += 24;

  var UT = ThisDate.getHours() + ((ThisDate.getMinutes() + (ThisDate.getSeconds() / 60)) / 60);
 
  T0 += UT * 1.002737909;
  T0 = T0 % 24;
  if (T0 < 0) T0 += 24;
//End GST

var tmp = alpha - ((TWOPI/24)*T0);
while (tmp < -Math.PI) {tmp += TWOPI;};
while (tmp > Math.PI) {tmp -= TWOPI;};

var lon = tmp * (360/TWOPI);
var lat = delta * (360/TWOPI);

//Generate the path of the appropriate xearth image

//lon is even
lon = Math.round(lon);
//if (lon & 1 != 0) {
if (lon % 2 != 0) {
  if (lon > 0) {
    lon -= 1;
    }
  else {
    lon += 1;
    }
  }
  
  // force even for mozilla 4.01-4.05
  // Consolidate lines, 4/5/01 - PRF
  lon = Math.round(lon/2) * 2;
  
if (lon <= -181) lon = -180;
if (lon >= 181) lon = 180;

//lat is odd
lat = Math.round(lat);
//if (lat & 1 == 0) {
if (lat % 2 == 0) {
  if (lat > 0) {
    lat -= 1;
    }
  else {
    lat += 1;
    }
  }
  
  // force odd for mozilla 4.01-4.05
  // Fixed broken algorithm, 4/5/01 - PRF
  lat =  (Math.round(lat/2 - 1) * 2) + 1;
  
  
if (lat <= -24) lat = -23;
if (lat >= 24) lat = 23;

var latStr; var lonStr;
if (lat < 0) 
  latStr = (-lat) + "S";
else 
  latStr = lat + "N";

if (lon < 0) 
  lonStr = (-lon) + "S";
else 
  lonStr = lon + "N";

return "images/xearths/" + latStr + "/" + lonStr + ".jpg";
//return lon;
}
// -->
			</script>
		</center>
	</body>

</html>