/// <summary>Creates an <c>XMPDateTime</c>-object from initial values.</summary>
 /// <param name="year">years</param>
 /// <param name="month">
 /// months from 1 to 12<br />
 /// <em>Note:</em> Remember that the month in
 /// <see cref="Sharpen.Calendar"/>
 /// is defined from 0 to 11.
 /// </param>
 /// <param name="day">days</param>
 /// <returns>Returns an <c>XMPDateTime</c>-object.</returns>
 public static IXmpDateTime Create(int year, int month, int day)
 {
     IXmpDateTime dt = new XmpDateTime();
     dt.Year = year;
     dt.Month = month;
     dt.Day = day;
     return dt;
 }
 /// <summary>Creates an <c>XMPDateTime</c>-object from initial values.</summary>
 /// <param name="year">years</param>
 /// <param name="month">
 /// months from 1 to 12<br />
 /// <em>Note:</em> Remember that the month in
 /// <see cref="Sharpen.Calendar"/>
 /// is defined from 0 to 11.
 /// </param>
 /// <param name="day">days</param>
 /// <param name="hour">hours</param>
 /// <param name="minute">minutes</param>
 /// <param name="second">seconds</param>
 /// <param name="nanoSecond">nanoseconds</param>
 /// <returns>Returns an <c>XMPDateTime</c>-object.</returns>
 public static IXmpDateTime Create(int year, int month, int day, int hour, int minute, int second, int nanoSecond)
 {
     IXmpDateTime dt = new XmpDateTime();
     dt.Year = year;
     dt.Month = month;
     dt.Day = day;
     dt.Hour = hour;
     dt.Minute = minute;
     dt.Second = second;
     dt.Nanosecond = nanoSecond;
     return dt;
 }
        /// <summary>Fixes the GPS Timestamp in EXIF.</summary>
        /// <param name="exifSchema">the EXIF schema node</param>
        /// <exception cref="XmpException">Thrown if the date conversion fails.</exception>
        private static void FixGpsTimeStamp(XmpNode exifSchema)
        {
            // Note: if dates are not found the convert-methods throws an exceptions,
            //          and this methods returns.
            var gpsDateTime = XmpNodeUtils.FindChildNode(exifSchema, "exif:GPSTimeStamp", false);

            if (gpsDateTime == null)
                return;

            try
            {
                var binGpsStamp = XmpCore.XmpUtils.ConvertToDate(gpsDateTime.Value);
                if (binGpsStamp.Year != 0 || binGpsStamp.Month != 0 || binGpsStamp.Day != 0)
                    return;

                var otherDate = XmpNodeUtils.FindChildNode(exifSchema, "exif:DateTimeOriginal", false)
                    ?? XmpNodeUtils.FindChildNode(exifSchema, "exif:DateTimeDigitized", false);

                var binOtherDate = XmpCore.XmpUtils.ConvertToDate(otherDate.Value);
                var cal = binGpsStamp.Calendar;
                cal.Set(CalendarEnum.Year, binOtherDate.Year);
                cal.Set(CalendarEnum.Month, binOtherDate.Month);
                cal.Set(CalendarEnum.DayOfMonth, binOtherDate.Day);
                binGpsStamp = new XmpDateTime(cal);
                gpsDateTime.Value = XmpCore.XmpUtils.ConvertFromDate(binGpsStamp);
            }
            catch (XmpException)
            {
                // Don't let a missing or bad date stop other things.
            }
        }