Use withZoneRetainFields() on DateTime.
Stephen

2008/6/27 Adam B <[EMAIL PROTECTED]>:
> Thank you all for you patience with me.  I see now that the millis value is
> always UTC based.  But I'm still at a loss for a solution.  I'll try being
> more concrete by describing something closer to our actual problem:
>
> The scenario:
> 1) We have a server application.  All the code deals with UTC time values
> (seconds since 1970-1-1)
> 2) We have a portable hardware device that needs to have it's clock
> synchronized with the server's clock.
> 3) The device is being used in Pacific Time (not UTC).
> 4) The device is time zone "unaware".  To set it's clock you merely give it
> a 32 bit value representing seconds since 1970-1-1.
>
> The algorithm:
> 1) Server determines current time (seconds since 1970-1-1 UTC)
> 2) Server adjusts this time value to be local to Pacific Time.
> 3) Server sends device the value calculated in step 2 as a 32 bit number.
>
> How do I achieve step #2 with the Joda-time library?
>
>
> On Fri, Jun 27, 2008 at 7:19 AM, P.Hill & E. Goodall <[EMAIL PROTECTED]>
> wrote:
>>
>> Adam B wrote:
>> > Thanks for the quick response, Stephen.  The issue is that I don't want
>> > to query any particular date field of DateTime but rather I essentially
>> > want to create a unix time value that represents the fields.  Let me ask
>> > in a different way:
>> >
>> > Current time in Australia is 2008-6-30 14:05:00.  The unix time value
>> > for this is 1214834700.  I want to know the current unix time value in
>> > Los Angeles.
>> >
>> > Of course I'd like a generalized solution:
>> >
>> > int unixTimeSomewhereElse(int localUnixTime, DateTimeZone localTimeZone,
>> > DateTimeZone targetTimeZone)
>> > {
>> >   ???
>> > }
>>
>> If by Unix time you mean the Long integer value, the value is always the
>> same, because it is defined as  "the difference, measured in
>> milliseconds, between the current time and midnight, January 1, 1970 UTC."
>>
>> --
>>
>> http://java.sun.com/j2se/1.4.2/docs/api/java/lang/System.html#currentTimeMillis()
>>
>> This is one of many places which remind us that it is a count from
>> ***UTC*** not from local midnight on 1/1/1970.
>>
>> -Paul
>>
>>
>>
>> -------------------------------------------------------------------------
>> Check out the new SourceForge.net Marketplace.
>> It's the best place to buy or sell services for
>> just about anything Open Source.
>> http://sourceforge.net/services/buy/index.php
>> _______________________________________________
>> Joda-interest mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/joda-interest
>
>
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> _______________________________________________
> Joda-interest mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/joda-interest
>
>

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Joda-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/joda-interest

Reply via email to