Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > General > Member Archives
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Details »»

Version: , by Sarge (Guest)
Developer Last Online: Jan 1970 Show Printable Version Email this Page

Version: Unknown Rating:
Released: 03-22-2001 Last Update: Never Installs: 0
 
No support by the author.

I am installing the hack for

Yesterdays Top Posters
And I want to make sure I got something correct

Is below the correct time to display for the last 24 hours?

Did I get the time right?

Sarge

$curTime = localtime();
$uts = time() - ($curTime[2]*3600 + $curTime[1]*60 + $curTime[0]);
$lts = $uts - (86401); // 3600 * 24 + 1 (to be completely honest about "yesterday")
unset($curTime);

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 03-22-2001, 07:35 PM
Guest
 
Posts: n/a
Default

Considering I wrote that little piece of an algorithm you posted, in a way yes. That will calculate timestamps for the previous day, but don't confuse that with the last 24 hours. The last 24 hours would simple be the current timestamp - 86401.

What you have pasted will generate two timestamps: $lts (lower timestamp) will be equal to 00:00:00 the previous day, and $uts (upper timestamp) equal to 23:59:59 the previous day.

These timestamps can be used in a MySQL SELECT statement for comparrison with the dateline member or such things as posts, threads, polls.
Reply With Quote
  #3  
Old 03-22-2001, 08:03 PM
Guest
 
Posts: n/a
Default

It's more accurate to use mktime

$24hrsback = mktime (date("H")-24, date("i"), date("s"), date("m"), date("d"), date("Y"));
$now = time();
Reply With Quote
  #4  
Old 03-23-2001, 01:31 AM
Guest
 
Posts: n/a
Default

How is it more accurate? The current timestamp is the current timestamp.

Personally I don't like making tons of function calls when none are needed. Inside your call to mktime() you are calling date 6 times. Sure with today's processors the overhead of a function call is not much, but then lets add in the fact that PHP isn't compiled code... I haven't looked at the source yet, but I bet every call to a function creates a new local scope for the function in addition to any memory used inside the date function. It also uses formatted strings. All that will add up to more then the simple mathmatical operations on array elements.

I'm not trying to start a coding debate. The simple point is, run my code 1e9 times and run code with extra function calls and I don't think you can argue which will be faster. I don't like wasteing CPU cycles or memory where I don't have to.
Reply With Quote
  #5  
Old 03-23-2001, 10:31 AM
Guest
 
Posts: n/a
Default

What have i to do, if I want to install this hack?

Is there a hack to show yesterday new posts, threads an new members? Hope someone could help me

Have a nice day
Tommy
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:59 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03603 seconds
  • Memory Usage 2,223KB
  • Queries Executed 20 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (4)postbit
  • (5)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete