Page 1 of 1

Time-Zone (Jira 720) ;-)

Posted: Mon Aug 28, 2017 1:03 pm
by kon
Hi,

what is the default time zone xTour calculates with? I have a PlanToursRequest with a StartDurationInterval at the first CustomerSite of 2018-01-01T14:00:00.000+01:00. The other properties for the tour are irrelevant in my opinion. In the ToursResponse the StartTime for the first TourEvent is 2018-01-01T15:00:00.000+02:00. So despite being the same LocalTime value after conversion, why is the value returned with that time zone?

Thanks
Fabian

Re: Time-Zone

Posted: Mon Aug 28, 2017 3:51 pm
by Bernd Welter
Hello Fabian,

could you please provide the complete request and response to us?

Worst case this is a bug and I'd like to forward it to our bugtracking.

Best regards,

Bernd

Re: Time-Zone

Posted: Tue Aug 29, 2017 12:16 pm
by kon
Request:

Code: Select all

<S:Envelope xmlns:S="http://www.w3.org/2003/05/soap-envelope">
	<S:Body>
		<ns4:planTours xmlns:ns4="http://xtour.xserver.ptvgroup.com" xmlns:ns3="http://xruntime.xserver.ptvgroup.com" xmlns:ns2="http://exceptions.xserver.ptvgroup.com">
			<request>
				<locations xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns4:CustomerSite" id="0">
					<routeLocation xmlns:ns6="http://routing.xserver.ptvgroup.com" xsi:type="ns6:OnRoadRouteLocation">
						<coordinate x="8.7750397554" y="53.09086988" />
					</routeLocation>
					<openingIntervals xmlns:ns6="http://time.xserver.ptvgroup.com" xsi:type="ns6:StartDurationInterval" start="2018-01-01T14:00:00.000+01:00" duration="0.0" />
				</locations>
				<locations xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns4:CustomerSite" id="1">
					<routeLocation xmlns:ns6="http://routing.xserver.ptvgroup.com" xsi:type="ns6:OnRoadRouteLocation">
						<coordinate x="8.8258599697" y="53.62503047" />
					</routeLocation>
				</locations>
				<locations xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns4:CustomerSite" id="2">
					<routeLocation xmlns:ns6="http://routing.xserver.ptvgroup.com" xsi:type="ns6:OnRoadRouteLocation">
						<coordinate x="8.877800038" y="53.109230032" />
					</routeLocation>
				</locations>
				<orders xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns4:PickupDeliveryOrder" pickupLocationId="0" deliveryLocationId="1" serviceTimeForPickup="1800.0" id="0" />
				<orders xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns4:PickupDeliveryOrder" pickupLocationId="1" deliveryLocationId="2" serviceTimeForPickup="1800.0" id="1" />
				<fleet>
					<vehicles>
						<ids>0</ids>
					</vehicles>
				</fleet>
				<distanceMode xmlns:ns6="http://dima.xserver.ptvgroup.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns6:DirectDistance" />
			</request>
		</ns4:planTours>
	</S:Body>
</S:Envelope>
Response:

Code: Select all

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
	<soap:Body>
		<ns2:planToursResponse xmlns:ns2="http://xtour.xserver.ptvgroup.com">
			<return>
				<costReport travelTime="13282.0" drivingTime="9682.0" distance="161389.0" />
				<tours vehicleId="0">
					<trips id="6f11ec2e-ea46-4c30-a2bb-bb0b43ff69ff">
						<stops locationId="0">
							<tasks orderId="0" taskType="PICKUP" />
						</stops>
						<stops locationId="1">
							<tasks orderId="0" taskType="DELIVERY" />
							<tasks orderId="1" taskType="PICKUP" />
						</stops>
						<stops locationId="2">
							<tasks orderId="1" taskType="DELIVERY" />
						</stops>
					</trips>
				</tours>
				<tourReports vehicleId="0">
					<costReport travelTime="13282.0" drivingTime="9682.0" distance="161389.0" />
					<tripReports tripId="6f11ec2e-ea46-4c30-a2bb-bb0b43ff69ff">
						<costReport travelTime="13282.0" drivingTime="9682.0" distance="161389.0" />
					</tripReports>
					<tourEvents startTime="2018-01-01T15:00:00.000+02:00" tripId="" locationId="0" duration="0.0">
						<eventTypes>TOUR_START</eventTypes>
					</tourEvents>
					<tourEvents startTime="2018-01-01T15:00:00.000+02:00" tripId="6f11ec2e-ea46-4c30-a2bb-bb0b43ff69ff" locationId="0" duration="0.0">
						<eventTypes>TRIP_START</eventTypes>
					</tourEvents>
					<tourEvents startTime="2018-01-01T15:00:00.000+02:00" tripId="6f11ec2e-ea46-4c30-a2bb-bb0b43ff69ff" locationId="0" orderId="0" duration="1800.0">
						<eventTypes>SERVICE</eventTypes>
					</tourEvents>
					<tourEvents startTime="2018-01-01T15:30:00.000+02:00" tripId="6f11ec2e-ea46-4c30-a2bb-bb0b43ff69ff" duration="4925.0">
						<eventTypes>DRIVING</eventTypes>
					</tourEvents>
					<tourEvents startTime="2018-01-01T16:52:05.000+02:00" tripId="6f11ec2e-ea46-4c30-a2bb-bb0b43ff69ff" locationId="1" orderId="0" duration="0.0">
						<eventTypes>SERVICE</eventTypes>
					</tourEvents>
					<tourEvents startTime="2018-01-01T16:52:05.000+02:00" tripId="6f11ec2e-ea46-4c30-a2bb-bb0b43ff69ff" locationId="1" orderId="1" duration="1800.0">
						<eventTypes>SERVICE</eventTypes>
					</tourEvents>
					<tourEvents startTime="2018-01-01T17:22:05.000+02:00" tripId="6f11ec2e-ea46-4c30-a2bb-bb0b43ff69ff" duration="4757.0">
						<eventTypes>DRIVING</eventTypes>
					</tourEvents>
					<tourEvents startTime="2018-01-01T18:41:22.000+02:00" tripId="6f11ec2e-ea46-4c30-a2bb-bb0b43ff69ff" locationId="2" orderId="1" duration="0.0">
						<eventTypes>SERVICE</eventTypes>
					</tourEvents>
					<tourEvents startTime="2018-01-01T18:41:22.000+02:00" tripId="6f11ec2e-ea46-4c30-a2bb-bb0b43ff69ff" locationId="2" duration="0.0">
						<eventTypes>TRIP_END</eventTypes>
					</tourEvents>
					<tourEvents startTime="2018-01-01T18:41:22.000+02:00" tripId="" locationId="2" duration="0.0">
						<eventTypes>TOUR_END</eventTypes>
					</tourEvents>
				</tourReports>
			</return>
		</ns2:planToursResponse>
	</soap:Body>
</soap:Envelope>

Re: Time-Zone

Posted: Tue Aug 29, 2017 2:05 pm
by Joost
According to the documentation xTour uses the planning horizon to determine the UTC offset to give back. If no planning horizon is given the xTour will determine the offset by looking in which timezones the locations are (note, only coordinates are used , not other details of the location). See https://xserver2-europe-eu-test.cloud.p ... eZones.htm

I believe the current behavior you are experiencing is consistent with that explanation. Setting a planning horizon should solve your issue.

Note: we are open for feedback on this topic if you have any to give.
Note 2: are you sure you want to use UTC+1? Keep in mind that due to daylight saving times Central European Time is currently UTC+2

Code: Select all

<S:Envelope xmlns:S="http://www.w3.org/2003/05/soap-envelope">
	<S:Body>
		<ns4:planTours xmlns:ns4="http://xtour.xserver.ptvgroup.com" xmlns:ns3="http://xruntime.xserver.ptvgroup.com" xmlns:ns2="http://exceptions.xserver.ptvgroup.com">
			<request>
				<locations xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns4:CustomerSite" id="0">
					<routeLocation xmlns:ns6="http://routing.xserver.ptvgroup.com" xsi:type="ns6:OnRoadRouteLocation">
						<coordinate x="8.7750397554" y="53.09086988" />
					</routeLocation>
					<openingIntervals xmlns:ns6="http://time.xserver.ptvgroup.com" xsi:type="ns6:StartDurationInterval" start="2018-01-01T14:00:00.000+01:00" duration="0.0" />
				</locations>
				<locations xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns4:CustomerSite" id="1">
					<routeLocation xmlns:ns6="http://routing.xserver.ptvgroup.com" xsi:type="ns6:OnRoadRouteLocation">
						<coordinate x="8.8258599697" y="53.62503047" />
					</routeLocation>
				</locations>
				<locations xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns4:CustomerSite" id="2">
					<routeLocation xmlns:ns6="http://routing.xserver.ptvgroup.com" xsi:type="ns6:OnRoadRouteLocation">
						<coordinate x="8.877800038" y="53.109230032" />
					</routeLocation>
				</locations>
				<orders xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns4:PickupDeliveryOrder" pickupLocationId="0" deliveryLocationId="1" serviceTimeForPickup="1800.0" id="0" />
				<orders xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns4:PickupDeliveryOrder" pickupLocationId="1" deliveryLocationId="2" serviceTimeForPickup="1800.0" id="1" />
				<fleet>
					<vehicles>
						<ids>0</ids>
					</vehicles>
				</fleet>
				<planToursOptions>
					<planningHorizon xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xmlns:ns6="http://time.xserver.ptvgroup.com" xsi:type="ns6:StartEndInterval" start="2018-01-01T00:00:00.000+01:00" end="2018-01-02T00:00:00.000+01:00" />
				</planToursOptions> 
				<distanceMode xmlns:ns6="http://dima.xserver.ptvgroup.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns6:DirectDistance" />			
			</request>
		</ns4:planTours>
	</S:Body>
</S:Envelope>

Code: Select all

<?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
  <soap:Body>
    <ns2:planToursResponse xmlns:ns2="http://xtour.xserver.ptvgroup.com">
      <return>
        <costReport travelTime="13282.0" drivingTime="9682.0" distance="161389.0"/>
        <tours vehicleId="0">
          <trips id="d4de9c2d-0d44-4135-aa32-e7c40eeb3540">
            <stops locationId="0">
              <tasks orderId="0" taskType="PICKUP"/>
            </stops>
            <stops locationId="1">
              <tasks orderId="0" taskType="DELIVERY"/>
              <tasks orderId="1" taskType="PICKUP"/>
            </stops>
            <stops locationId="2">
              <tasks orderId="1" taskType="DELIVERY"/>
            </stops>
          </trips>
        </tours>
        <tourReports vehicleId="0">
          <costReport travelTime="13282.0" drivingTime="9682.0" distance="161389.0"/>
          <tripReports tripId="d4de9c2d-0d44-4135-aa32-e7c40eeb3540">
            <costReport travelTime="13282.0" drivingTime="9682.0" distance="161389.0"/>
          </tripReports>
          <tourEvents startTime="2018-01-01T14:00:00.000+01:00" tripId="" locationId="0" duration="0.0">
            <eventTypes>TOUR_START</eventTypes>
          </tourEvents>
          <tourEvents startTime="2018-01-01T14:00:00.000+01:00" tripId="d4de9c2d-0d44-4135-aa32-e7c40eeb3540" locationId="0" duration="0.0">
            <eventTypes>TRIP_START</eventTypes>
          </tourEvents>
          <tourEvents startTime="2018-01-01T14:00:00.000+01:00" tripId="d4de9c2d-0d44-4135-aa32-e7c40eeb3540" locationId="0" orderId="0" duration="1800.0">
            <eventTypes>SERVICE</eventTypes>
          </tourEvents>
          <tourEvents startTime="2018-01-01T14:30:00.000+01:00" tripId="d4de9c2d-0d44-4135-aa32-e7c40eeb3540" duration="4925.0">
            <eventTypes>DRIVING</eventTypes>
          </tourEvents>
          <tourEvents startTime="2018-01-01T15:52:05.000+01:00" tripId="d4de9c2d-0d44-4135-aa32-e7c40eeb3540" locationId="1" orderId="0" duration="0.0">
            <eventTypes>SERVICE</eventTypes>
          </tourEvents>
          <tourEvents startTime="2018-01-01T15:52:05.000+01:00" tripId="d4de9c2d-0d44-4135-aa32-e7c40eeb3540" locationId="1" orderId="1" duration="1800.0">
            <eventTypes>SERVICE</eventTypes>
          </tourEvents>
          <tourEvents startTime="2018-01-01T16:22:05.000+01:00" tripId="d4de9c2d-0d44-4135-aa32-e7c40eeb3540" duration="4757.0">
            <eventTypes>DRIVING</eventTypes>
          </tourEvents>
          <tourEvents startTime="2018-01-01T17:41:22.000+01:00" tripId="d4de9c2d-0d44-4135-aa32-e7c40eeb3540" locationId="2" orderId="1" duration="0.0">
            <eventTypes>SERVICE</eventTypes>
          </tourEvents>
          <tourEvents startTime="2018-01-01T17:41:22.000+01:00" tripId="d4de9c2d-0d44-4135-aa32-e7c40eeb3540" locationId="2" duration="0.0">
            <eventTypes>TRIP_END</eventTypes>
          </tourEvents>
          <tourEvents startTime="2018-01-01T17:41:22.000+01:00" tripId="" locationId="2" duration="0.0">
            <eventTypes>TOUR_END</eventTypes>
          </tourEvents>
        </tourReports>
      </return>
    </ns2:planToursResponse>
  </soap:Body>
</soap:Envelope>

Re: Time-Zone

Posted: Wed Aug 30, 2017 6:39 am
by kon
Note 2: are you sure you want to use UTC+1? Keep in mind that due to daylight saving times Central European Time is currently UTC+2
Be careful: The date which I used is 2018-01-01T14:00:00.000+01:00. On this date there is no daylight saving times.
If no planning horizon is given the xTour will determine the offset by looking in which timezones the locations are
Will it take the time zone from when the request is sent ("now" in this case)? That would be an explanation.
Note: we are open for feedback on this topic if you have any to give.
Maybe you could add the opening intervals for your time zone calculation routine, if there is no planning horizon.

Re: Time-Zone (Jira 720) ;-)

Posted: Thu Aug 31, 2017 11:57 am
by Joost
You are right about the time zones, I did not look at the date. We have past your feedback back to development internally.

Re: Time-Zone (Jira 720) ;-)

Posted: Fri Nov 17, 2017 3:34 pm
by Bernd Welter
Hi there,
Here is an explanation from DEV (thanks to Monika)
The assumption in the forum is correct. If there is no time zone given in the request (either defined in the planning horizon or in the opening intervals of sites), we ask the map about the time zone of the locations. That information is given in the current timezone of the xServer.
Please be aware that if no timezone is specified in the opening intervals nor in the planning horizon, the opening intervals will also be assumed to be in the timezone given by the map. So that could be a problem for the tour planning if the timezone is relevant.
Our recommendation would be to always specify timezones if the user knows them anyway. The automatic detection is only a convenience feature meant for the cases where a timezone does not really matter and/or is clearly determinable.
If no planning horizon is given (that would always be the best option to solve all timezone-hickhack-problems), the following behaviour takes place: If some sites have specified opening intervals (with timezone as in the forum example) and some sites don't have any opening intervals, the xTour service detects no problem but it is quite random which timezone is taken for the response. In the example, the first detected timezone is the one from a site without opening interval, so local time. This timezone is used for the response. If the first detected timezone would be one from a site with opening interval, the response would be specified in that timezone.
Feedback is welcome!

Best regards,
Bernd