this will work.I have tried both gave one day unique bucket.

I just realized, If I sync all clients to one zone then date will remain same for all.

One Zone date will give materialize view to row.

On Mon, Apr 30, 2012 at 11:43 PM, samal <samalgorai@gmail.com> wrote:
hhmm. I will try both. thanks


On Mon, Apr 30, 2012 at 11:29 PM, Tyler Hobbs <tyler@datastax.com> wrote:
Err, sorry, I should have said ts - (ts % 86400).  Integer division does something similar.


On Mon, Apr 30, 2012 at 12:39 PM, samal <samalgorai@gmail.com> wrote:
thanks I didn't noticed.
run script for 5  minutes => divide seems to produce result ,modulo is still changing. If divide is ok will do the trick.
I will run this script on Singapore, East coast server, and New delhi server whole night today.

======================
unix              =>   1335806983422
unix /1000        =>   1335806983.422
Divid i/86400     =>   15460.728969907408
Divid i/86400 INT =>   15460
Modulo i%86400    =>   62983
======================
======================
unix              =>   1335806985421
unix /1000        =>   1335806985.421
Divid i/86400     =>   15460.728993055556
Divid i/86400 INT =>   15460
Modulo i%86400    =>   62985
======================
======================
unix              =>   1335806987422
unix /1000        =>   1335806987.422
Divid i/86400     =>   15460.729016203704
Divid i/86400 INT =>   15460
Modulo i%86400    =>   62987
======================
======================
unix              =>   1335806989422
unix /1000        =>   1335806989.422
Divid i/86400     =>   15460.729039351852
Divid i/86400 INT =>   15460
Modulo i%86400    =>   62989
======================
======================
unix              =>   1335806991421
unix /1000        =>   1335806991.421
Divid i/86400     =>   15460.7290625
Divid i/86400 INT =>   15460
Modulo i%86400    =>   62991
======================
======================
unix              =>   1335806993422
unix /1000        =>   1335806993.422
Divid i/86400     =>   15460.729085648149
Divid i/86400 INT =>   15460
Modulo i%86400    =>   62993
======================
======================
unix              =>   1335806995422
unix /1000        =>   1335806995.422
Divid i/86400     =>   15460.729108796297
Divid i/86400 INT =>   15460
Modulo i%86400    =>   62995
======================
======================
unix              =>   1335806997421
unix /1000        =>   1335806997.421
Divid i/86400     =>   15460.729131944445
Divid i/86400 INT =>   15460
Modulo i%86400    =>   62997
======================
======================
unix              =>   1335806999422
unix /1000        =>   1335806999.422
Divid i/86400     =>   15460.729155092593
Divid i/86400 INT =>   15460
Modulo i%86400    =>   62999
======================
 

On Mon, Apr 30, 2012 at 10:44 PM, Tyler Hobbs <tyler@datastax.com> wrote:
getTime() returns the number of milliseconds since the epoch, not the number of seconds: http://www.w3schools.com/jsref/jsref_gettime.asp

If you divide that number by 1000, it should work.


On Mon, Apr 30, 2012 at 11:28 AM, samal <samalgorai@gmail.com> wrote:
I did it with node.js but it is changing after some interval.

<code>
setInterval(function(){
  var d =new Date().getTime();
  console.log("====================== ");
  console.log("unix         =>  ",d);
  i=parseInt(d)
  console.log("Divid i/86400=>  ",i/86400);
  console.log("Modulo i%86400=> ",i%86400);
  console.log("====================== ");
},2000);

</code>
Am I doing wrong?


On Mon, Apr 30, 2012 at 9:54 PM, Tyler Hobbs <tyler@datastax.com> wrote:
Correct, that's exactly what I'm saying.


On Mon, Apr 30, 2012 at 10:37 AM, samal <samalgorai@gmail.com> wrote:
thanks tyler for reply.

are you saying  user1uuid_{ts%86400} would lead to unique day bucket which will be timezone {NZ to US} independent? I will try.


On Mon, Apr 30, 2012 at 8:25 PM, Tyler Hobbs <tyler@datastax.com> wrote:
Don't use dates or datestamps as the buckets for your row keys, use a unix timestamp modulo whatever size you want your bucket to be instead.  Timestamps don't involve time zones or any of that nonsense.

So, instead of having keys like "user1uuid_30042012", the second half would be replaced the current unix timestamp mod 86400 (the number of seconds in a day).


On Mon, Apr 30, 2012 at 1:46 AM, samal <samalgorai@gmail.com> wrote:
Hello List,

I need suggestion/ recommendation on time series data.

I have requirement where users belongs to different timezone and they can subscribe to global group. 
When users at specific timezone send update to group it is available to every user in different timezone.

I am using GroupSubscribedUsers CF where all update to group are push to "Each User" time line, and key is timelined by useruuid_date(one day update of all groups) and columns are group updates.

GroupSubscribedUsers ={
    user1uuid_30042012:{//this user belongs to same timezone
         timeuuid1:JSON[group1update1]
         timeuuid2:JSON[group2update2]
         timeuuid3:JSON[group1update2]
        timeuuid4:JSON[group4update1]
   },
  user2uuid_30042012:{//this user belongs to different timezone where date has changed already  to 1may but  30 april is getting update
         timeuuid1:JSON[group1update1]
         timeuuid2:JSON[group2update2]
         timeuuid3:JSON[group1update2]
        timeuuid4:JSON[group4update1]
        timeuuid5:JSON[groupNupdate1]
   },

}

I have noticed  this approach is good for single time zone when different timezone come into picture it breaks.

I am thinking of like when user pushed update to group ->get user who is subscribed to group->check user timezone->push time series in user time zone. So for one user update will be on 30april where as other may have on 29april and 1may, using timestamps i can find out hours ago update came.

Is there any better approach?   
  

Thanks,

>>>Samal





--
Tyler Hobbs
DataStax





--
Tyler Hobbs
DataStax





--
Tyler Hobbs
DataStax





--
Tyler Hobbs
DataStax