Exemple #1
0
int WallStHoursFromLocal(int *wall_st_hours_from_gmt_out) {
    Time now = Now();
    int local_hours_from_gmt   = RFC822TimeZone(LocalTimeZone(now));
    int wall_st_hours_from_gmt = RFC822TimeZone(WallStTimeZone(now));
    if (wall_st_hours_from_gmt_out) *wall_st_hours_from_gmt_out = wall_st_hours_from_gmt;
    return -1 * local_hours_from_gmt + wall_st_hours_from_gmt;
}
Exemple #2
0
dng_string dng_date_time_info::Encode_ISO_8601 () const
	{
	
	dng_string result;
	
	if (IsValid ())
		{
		
		char s [256];
	
		sprintf (s,
				 "%04u-%02u-%02u",
				 (unsigned) fDateTime.fYear,
				 (unsigned) fDateTime.fMonth,
				 (unsigned) fDateTime.fDay);
				 
		result.Set (s);
		
		if (!fDateOnly)
			{
			
			sprintf (s,
					 "T%02u:%02u:%02u",
					 (unsigned) fDateTime.fHour,
					 (unsigned) fDateTime.fMinute,
					 (unsigned) fDateTime.fSecond);
					 
			result.Append (s);
			
			if (fSubseconds.NotEmpty ())
				{
				
				bool subsecondsValid = true;
				
				uint32 len = fSubseconds.Length ();
				
				for (uint32 index = 0; index < len; index++)
					{
					
					if (fSubseconds.Get () [index] < '0' ||
						fSubseconds.Get () [index] > '9')
						{
						subsecondsValid = false;
						break;
						}
						
					}
			
				if (subsecondsValid)
					{
					result.Append (".");
					result.Append (fSubseconds.Get ());
					}
					
				}
			
			// Kludge: Early versions of the XMP toolkit assume Zulu time
			// if the time zone is missing.  It is safer for fill in the
			// local time zone. 
			
			dng_time_zone tempZone = fTimeZone;
				
			if (tempZone.NotValid ())
				{
				tempZone = LocalTimeZone (fDateTime);
				}
				
			result.Append (tempZone.Encode_ISO_8601 ().Get ());
			
			}
			     
		}
	
	return result;
	
	}