Is timesync still required for Windows Server 2012 R2?

64

Windows has a built-in function to do time synchronisation. And by default it gets the time from time.windows.com. There is no need to use a third-party application.

You can (but you should not need to) change the settings by right-clicking the clock in the taskbar > Adjust date/time > Internet Time.

Or from the command line:

w32tm /config /syncfromflags:manual /manualpeerlist:time.windows.com /update

Share:
64

Related videos on Youtube

ThaCoder
Author by

ThaCoder

Updated on September 18, 2022

Comments

  • ThaCoder
    ThaCoder almost 2 years

    I have a database that looks like this:👇👇

    images 🌅

    | id            | name          | src         | status    |
    | ------------- |---------------| ------------| ----------|
    | 1             | nice sun set  | 1020288.jpg | published |
    | 2             | poor sun set  | 1120288.jpg | published |
    | 3             | best sun set  | 3120288.jpg | deleted   |
    | ------------- |---------------| ------------| --------- |
    

    image_views 👀

    | id            | image_id      | browser_id🌎 | created_at         |
    | ------------- |---------------| ------------ | ------------------ |
    | 1             | 2             | 1020288e3221 |2020-02-23 13:55:11 |
    | 2             | 1             | 1120288221ww |2020-02-27 13:50:51 |
    | ------------- |---------------| ------------ | ------------------ |
    

    Now in my laravel App,

    I want to get the most viewed image in the PAST last 7 days.

    ( i want to have a column of image_views and those views 👀 should be grouped by browser id ).

    so here is what i have tried:👇👇

    $image_views = DB::table('image_views')
                            ->selectRaw('count(*) as view_count')
                            ->where(function($query){
                                $query->where('image_views.image_id', 'images.id');
                                $query->whereDate('image_views.created_at', '>=',  Carbon::now()->subDays(7)->toDateTimeString() );
                            });
    
    $image = Image::select(['images.*', DB::raw('(' . $image_views->toSql() . ') as views ')])
    ->limit(1)
    ->orderBy('views', 'desc')
    ->where('images.status','published')
    ->mergeBindings($image_views)
    ->get();
    
    return $image;
    

    So unfortunately the posted above☝☝ code does not work😩

    It only return blank results.

    By the way i have lot of views in image_views table starting from 2⃣0⃣1⃣9⃣ to now, just that i couldn't post all here..


    THE FUNNY THING IS THAT IF I CONVERT IT TO SQL AND PASTE IT IN PHPMYADMIN IT WORKS LIKE A CHARM

    return $image->toSql();
    //->mergeBindings($image_views)
    //->get();
    

    PLEASE SOMEONE TELL ME WHAT I AM DOING WRONG IN LARAVEL!!🙌

    • joeqwerty
      joeqwerty about 10 years
      The Windows Time Sync that you're referring to is only applicable to domain joined clients in a Windows AD domain. If you're not running a Windows AD Domain then yes, you'll need to continue to use TimeSync. This isn't new to Windows Server 2012R2.
    • joeqwerty
      joeqwerty about 10 years
      Technically you could use the Windows Time Service but you'd have to manually configure it on all of your workstations and the server. Again, this isn't new to Windows Server 2012R2.
    • myron-semack
      myron-semack about 10 years
      By "TimeSync", are you referring to a third-party piece of software? Or do you mean the built-in Windows Time Service?
    • impossible
      impossible about 10 years
      Yes, a third party windows service to keep the clock updated. So the Windows Time won't keep the clock updated automatically it seems. I'll go ahead and put TimeSync on Windows again. Thx
    • myron-semack
      myron-semack about 10 years
      Every version of Windows since XP has a built in NTP client that will keep the clock synced over the Internet. If the Windows Time Service is not working for you, it is probably misconfigured. You should probably fix that rather than load an unnecessary third-party application.
    • Akina
      Akina over 4 years
      I want to get the most viewed image in the PAST last 7 days. Only ONE? Or one per some group? If there is 2 or more images with the same max. views amount - do you need in all, or only one of them? Anycase solve this task using pure SQL at first...
    • Foued MOUSSI
      Foued MOUSSI over 4 years
      Could you plz add your Image and ImageView models ?
    • ThaCoder
      ThaCoder over 4 years
      i want only 1 image results whether they are equal or not. and yes it is working in pure sql the problem is implementing in LARAVEL.
    • ThaCoder
      ThaCoder over 4 years
      @Foued MOUSSI they are empty that's why i did not add them
  • myron-semack
    myron-semack about 10 years
    How to configure the Windows Time Service: technet.microsoft.com/en-us/library/cc773263(v=ws.10).aspx